Graphics in Octave – multiplots

Even though I’ve decided Octave is probably best avoided for publication quality graphics, sometimes it’s nice to be able to spit out a nice graph. Probably the best way to learn to do this sort of thing in Octave is to browser the Matlab documentation. Be warned though, not everything works! Behold the octave multiplot scriptlet:

%a,d are sets of data points
%t is the common axis for each data set
%param1 and param2 are numbers that characterise
%the graph - useful if you want to toy with some
%parameters and print out images of everything
ofname = sprintf("my_image-%d-%d",param1,param2)
%plot the first data set. '-or' means '-' for line style 'o' to draw on the data points, and 'r' for red
%tell octave you've got more plotting to do
hold on
%plot the second data set as just points
legend('data set one','data set two')
title('my happy graph')
hold off
%print it as a png image

And you’re done. Here’s an example:nice_picture.png


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: