ctioga2 has moved to sourceforge. You should be redirected there shortly


the polymorphic plotting program

Customizing the look of axes and labels

Here are ways to tweak various things about axes and things.

Alternative X or Y axes

It is possible to use different axes for different curves in a single plot, using --y2 or --x2:

ctioga2 -X --math 'sin(x)' 'cos(x)' -y '$y$ values' \
	--y2 'x**2' -y '$y_2$ values' \
	-x '$x$ values' /color Blue

This example also shows how to define the label for the current X and Y axes; the -x and -y commands provide many options to fine-tune the look of the labels.

X and Y ranges

It is possible to define the X and Y ranges of the plot thus:

ctioga2 -X --math 'sin(x)' 'cos(x)' \
	--xrange -20: --yrange -0.8:2

Alternatively, it is possible to use --margin to leave a certain fraction of the plots around the data points; to make the reading easier. In this case, we leave 3%:

ctioga2 -X --math --margin 0.03 \
	'sin(x)' 'cos(x)'

Log plots

It is possible to use a log scale by passing the --xlog or --ylog commands:

ctioga2 -X --math --ylog --margin 0.03 \
	'1 + x**2' '1 + x**4' '1 + x**6' 

Tweaking the looks of axes

It is possible to change the look of each of the sides of the plot individually using the --axis-style and the companion --label-style commands that set the style of the axis and of the labels respectively.

ctioga2 -X --math 'sin(x)' 'cos(x)' \
	--top off --bottom major-num /stroke_color Blue \
	--axis-style right /decoration major \
	--label-style bottom /color Blue 

Controlling tick position and labels

Starting from ctioga2 version 0.6, it is possible to control the appearance and position of major ticks and tick labels, through the use of the ticks command or through various options to the axis-style command:

math /xrange 1e3:7e5
margin 0.07
plot log(x)
ticks bottom /format "%.1e" 

The /format argument to the ticks command is interpreted as a sprintf format specification.

It is possible to specify the ticks position using the /major and /minor options to the ticks command:

math /xrange 1e3:7e5
margin 0.07
plot log(x)
top line
ticks bottom /minor 1e5,1.5e5,2e5,3.5e5,5e5,6e5 /major 0.5e5,2.5e5,4e5,5.5e5 \
background-lines bottom Gray /style Dots

See how the background lines follow the position of the major ticks.

Here, we disabled the ticks on the top axis using top as they would still follow the usual convention, which would have a disconcerting effect. A simple way to take care of that is to use variables:

minor = 1e5,1.5e5,2e5,3.5e5,5e5,6e5
major = 0.5e5,2.5e5,4e5,5.5e5
math /xrange 1e3:7e5
margin 0.07
plot log(x)
ticks bottom /minor $(minor) /major $(major) /format="%.1e"
ticks top /minor $(minor) /major $(major)
background-lines bottom Gray /style Dots

Using the /labels option, you can even specify the exact label for all the ticks. The price to pay for that level of control is that you must provide manually the location for all the major ticks (and the minor ones if you want them to show up too).

math /xrange -2:2
margin 0.02
plot sin(3.141592*x)
top line
ticks bottom /minor -1.75,-1.25,-0.75,-0.25,0.25,0.75,1.25,1.75\
      /major -2,-1.5,-1,-0.5,0,0.5,1,1.5,2 \