Formatting Axes

Giving specific format to the labels of the axes will improve the final visualization of the graph.

Single graph

x = [2001,2002,2003,2004]

% defining x and y values

y = [0.000002,0.00002323,0.00000420023,0.0000085] o = struct

% initializing options struct

o.xAxisFormat = '.0f' o.yAxisFormat = '.2s' bar(x,y,o)

Overlayed graphs

When using the overlay function, the formatting options must be defined on the first graph.

x = [2001,2002,2003,2004]

% defining x and y values

y1 = [5000000,8323000,2002300,1500000] o1 = struct

% initializing options struct

o1.show = false o1.xAxisFormat = '.0f'

% x-axis format of final graph

o1.yAxisFormat = '.2s'

% y-axis format of final graph

o1.xAxisTicks = 4

% number of x-axis ticks of final graph

p1 = plot(x,y1,o1) y2 = [2000000,2323000,4200230,8500000] o2 = struct

% initializing options struct

o2.show = false p2 = plot(x,y2,o2) overlay({p1,p2})

% final graph

Related functions

area | bar | histogram | plot | plotyy | scatter | stem