Using presentation options
Let’s go towards more aesthetic considerations.
Depending on what you plot, external presentation will differ. We have already
seen how to add title (introduced by --title or -t) and legends (introduced by
-l or --legend) to the plot. Note that --title is a global setting. As there
is only one title for the entire plot, it can be specified wherever you want
whereas the legend acts on a given dataset or function and has to be specified
just before the curve on which it will apply. This consideration holds true
for most of the options we will present in this section as they generally
apply to a given curve.
Particular options
Red is not your favorite color ? You have a lot more choice.. You just have to
introduce the --color or -c options before the plot you would like to colorize
ctioga --color Violet trig.dat \
-c Blue @1:3 \
-c Turquoise @2:3 \
-c PowderBlue trigh.dat \
-t 'Blue tones'
The complete set of available colors can be found in the Tioga documentation at
http://theory.kitp.ucsb.edu/paxton/tioga_doc/classes/Tioga/ColorConstants.html
Background color could also be specified using the --background option to make
plots less crude
ctioga --background Ivory trig.dat -l 'Ivory background'
Well, colors are a great thing but for use on a B&W printer, you would
certainly prefer some black color and different linestyle:
use the --mono switch
ctioga --mono trig.dat @1:3 @2:3 -t 'Black trigonometry'
But what if the Ctioga’s default for linestyle are not the one you would expect ? Just change them:
ctioga --line-style Line_Type_Dot trig.dat \
--line-style Line_Type_Dash @2:3 \
--line-style Line_Type_Dot_Long_Dash @1:3 \
-t 'Some line types'
Once again, line types are derived from those of tioga. You can find the complete set and an explication how to define it yourself at
http://theory.kitp.ucsb.edu/paxton/tioga_doc/classes/Tioga/Strokes.html
Note that line-style is a switch. Every coming curve will have the
last-defined line-type, even if you switch to --mono
One curve could be more important than an other, a way of underlining it is to
play on line-width.
ctioga --line-width 0.5 trig.dat @1:3 \
--line-width 2 @2:3 \
-t 'See the circle ?'
Just as --line-style, it has an influence over all coming curves until an
other --line-width is issued.
What about plotting real data and trying to fit some model on it. Well Ctioga has no fitting routine as it only concerns plotting (but who knows, one day..?). Nevertheless, you can use your favorite tool to find the fitting parameters and Ctioga to plot the result:
ctioga -l 'model' --math --xrange -4:4 'sin(x)' \
-l 'data' --text --marker Plus --line-width 0 trig.dat \
-t 'comparison data/model'
Note that you switch back from math mode to data-reading mode with the switch
--text (because datas are in a text file). Once again, the list of available
markers (including Cross, Diamond, Semicircle but also Arrow, Hand or Check)
is available here:
http://theory.kitp.ucsb.edu/~paxton/tioga_doc/classes/Tioga/MarkerConstants.html
If you like, you can also have the markers of a different color than the underlying curve:
ctioga --marker Plus --marker-color Blue trig.dat \
-t 'Bicolored graph'
Global options
Together with --title, there is two other global settings, namely --xlabel
(or -x) to specify the label of the x axis and --ylabel (or -y) for the y one.
You can call them wherever you want. For example, a plot of x = cos(t) could
be written as
ctioga -l '$x = \cos(t)$' --math 'cos(x)' -x '$t$' -y '$x$' \
-t 'Evolution of position $x$ in time'
By default, Ctioga produces squared plots, which is useful for inclusion in
2 columns papers but not that good-looking for oral presentation. To correct
this, you have the switch --golden-ratio to set the ratio of height to length
to the well known (1 + sqrt(5))/2:
ctioga trig.dat @1:3 @2:3 -t 'Gold trigonometry' --golden-ratio
Or you can define this ratio yourself
ctioga trig.dat @1:3 @2:3 \
-t 'Silver trigonometry' \
--aspect-ratio 2
ctioga trig.dat @1:3 @2:3 \
-t 'Bronze trigonometry' \
--aspect-ratio 0.5
Options --xrange and --yrange that we met at the beginning of this tutorial
come with the option --margin which gives an extra space (0.1 represents 10%)
around the curve so that it does not touch the borders
ctioga trig.dat --margin 0.1 \
-t '10\% air on both sides'
If you want only air around the vertical side, use in conjonction with
--xrange
ctioga trig.dat --margin 0.1 --xrange -3.14:3.14 \
-t '10\% air on vertical side'
Ctioga automaticaly choose some set of colors if none is defined on the line. You can change it if it does not fit your requirement. Currently available sets are “default” and “colorblind”
ctioga trig.dat @1:3 @2:3 trigh.dat @1:3 @2:3 \
-t 'default color-set'
ctioga --color-set colorblind \
trig.dat @1:3 @2:3 trigh.dat @1:3 @2:3 \
-t 'colorblind color-set'
You can also use the “gradient” feature, for example going from Blue to Red in 6 steps
ctioga --color-set gradient:Blue--Red,6 \
trig.dat @1:3 @2:3 trigh.dat @1:3 @2:3 \
-t 'Gradient feature with 6 steps'
With less steps, the colors repeat itself
ctioga --color-set gradient:Blue--Red,3 \
trig.dat @1:3 @2:3 trigh.dat @1:3 @2:3 \
-t 'Gradient feature with 3 steps'
The same is true for markers and line-types but for the moment, only the
“default” is available. If you have ideas of sets, just email them to us and
we will be happy to add them.
ctioga -m --marker-set default trig.dat @1:3 @2:3 \
-t 'Using Markers'
ctioga --mono --line-style-set standard trig.dat @1:3 @2:3 \
-t 'Using line-styles (which is already the default...)'
Finally, you can also have a different set of colors for you markers
ctioga -m --marker-set default \
--marker-color-set colorblind \
trig.dat @1:3 @2:3 \
-t 'Using Markers'
Axis manipulation
Logarithmic axes can be specified at the beginning of the plot with options
--xlog and --ylog. In this case, an exponential looks like a mere right line
ctioga --ylog --math 'exp(x)' -t 'Some straight line'
ctioga --xlog --ylog --math-xrange 0.001:1000 \
--math '1/x**2' '1/x**3' -t 'Power laws'
One astrophysical example of such a use is the stellar Initial Mass Function (IMF) which is known to be a power law by pieces
ctioga --xlog --ylog --math \
--math-xrange 0.1:1 -l 'Low masses' '1/x**1.3' \
--math-xrange 1:10 -l 'Intermediate masses' '1/x**2.35' \
--math-xrange 10:100 -l 'High masses' '1/x**4*10**1.65' \
-x '$\log_{10}(M/M_\odot)$' -y '$\log_{10}(dN/dM)$' \
-t 'Kroupa IMF' --golden-ratio
There is one detail you have to be careful at: the corresponding range has to
be given in logscale also. For example, if you want to plot the previous
figure between 0.01 and 1000, you have to specify --xrange -2:3 rather than
--xrange 0.01:1000
ctioga --xlog --ylog --xrange -2:3 --math \
--math-xrange 0.1:1 -l 'Low masses' '1/x**1.3' \
--math-xrange 1:10 -l 'Intermediate masses' '1/x**2.35' \
--math-xrange 10:100 -l 'High masses' '1/x**4*10**1.65' \
-x '$\log_{10}(M/M_\odot)$' -y '$\log_{10}(dN/dM)$' \
-t 'Kroupa IMF' --golden-ratio
From time to time, it can also be useful to stretch or shrink axes by a given
factor, for example in a fitting purpose or to compare two set of data that do
note have the scale. Use --xfact and --yfact. Compare
ctioga trig.dat @1:4 -t 'Scaling problem'
ctioga trig.dat --xfact 0.5 --yfact 5 @1:4 -t 'Scaling resolved'