Recap of the hierarchy of each plot element

From Octave
Revision as of 14:14, 13 July 2012 by Indium (talk | contribs) (Created page with "First of all, Octave aims at being compatible with Matlab (TM) as much as possible, so the graphics part is very similar too to Matlab. In Octave the first choice to make is t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

First of all, Octave aims at being compatible with Matlab (TM) as much as possible, so the graphics part is very similar too to Matlab. In Octave the first choice to make is the graphics_toolkit(). Standard is the 'gnuplot' toolkit using the Gnuplot software package . The second choice is 'fltk' fltk. You might want to try to test both of them for your plotting aims to see which solves your problem.

After the choice of the graphics_toolkit('gnuplot') or graphics_toolkit('fltk'), there is the following hierarchy to address when make/adapting your plot:

- root (any hierarchy needs to start somewhere) - gcf() (the handle to your figure: one for every figure) - gca() (the handle to the axes inside a figure (several if you have subplots) - p=plot(x,y) (p is the handle to the data, data symbols, data line thickness, etc)

Let's do an example:

graphics_toolkit('gnuplot');
x=0:0.1:3;
y=sin(x);
p=plot(x,y,'b');

This should get you a plot of a part of a sine wave. Octave has used all standard properties like line widths, fonts, etc, except for the line color which was forced to be blue (via the 'b').