Plotting simple data files
Ctioga has been primarily intended to rapidly plot data files from the command line. It’s syntax is not far from the one used by gnuplot.
The simplest command (assuming you are in directory examples/ with datafile trig.dat) is
ctioga trig.dat -t 'data sine'
which plot column 2 with respect to column 1 and automaticaly set the width and height of the plot, give the legend with respect to the filename
If you append an other file name (for example trigh.dat for some hyperbolic trigonometry):
ctioga trig.dat trigh.dat -t 'data sine and hyperbolic tangente'
it will plot the two dataset on the same plot (with different colors and legends) and adapt automatically the extension to the biggest x and y used so that both dataset are completely visible on the graph
Let’s see how to change the columns we would like to use.
To plot the third column rather than the second one, you use
ctioga trig.dat@1:3 -t 'data cosine'
Or to plot a circle with parametric representation
ctioga trig.dat@2:3 -t 'Circle'
Note that if there is no filename before the ”@”, the previous file is used instead:
ctioga trig.dat @1:3 @2:3 -t 'Some trigonometry'
plots the sine (which is implicitly 1:2), the cosine (1:3) and the circle
(@2:3)
If you add the other file, depending on where you put it, the results will change.
Compare
ctioga trig.dat trigh.dat @1:3 @2:3 -t 'Mixing 1'
ctioga trig.dat @1:3 trigh.dat @2:3 -t 'Mixing 2'
ctioga trig.dat @1:3 @2:3 trigh.dat -t 'Mixing 3'
To put some legends, use the --legend (or -l) option. Don’t forget to protect
your legend with simple quotes as in ‘my legend’ whenever it contains spaces
or things that could be interpreted by your shell. Bear also in mind that it
will finally get passed to LaTeX, so use ”^” and ”_” with caution.
ctioga --legend sine trig.dat \
-l cosine @1:3 \
-l 'beautiful circle' @2:3 \
-t 'Some trigonometry'
You can also use LaTeX coding in your legends
ctioga -l '$\sin(x)$' trig.dat \
-l '$\cos(x)$' @1:3 \
-l '$r = \sqrt{\cos^2(x) + \sin^2(x)} = 1$' @2:3 \
-t 'Some trigonometry'
Data files and expansion
Ctioga has a feature for automatic data set expansion. When you’re interested
to plot several columns of one file as a function of only one column, it is
interesting to use the 2##4 syntax. file.dat@2##4 is exactly equivalent to
file.dat1:2 file.dat1:3 file.dat@1:4. This can reduce quite a bit the
tediousness that can come sometimes…
ctioga -t 'Use of expansion' trig.dat@1:2##3
Starting from ctioga 1.3, you can use tis mechanism as well for nearly
any backend, including the --math one:
ctioga -t 'Math and expansion' --math 'sin(x + 1##4)'
Filters
Ctioga also have some filters you can apply to your data.
From time to time, data are not computed in the way we would like to. For example
ctioga -t 'Unsorted' noise.dat
That’s why Ctioga comes with the --sort filter
ctioga -t 'Sorted' --sort noise.dat
That’s better. But it is quite hard to recognize the cosine underneath the noise. Let’s apply some smoothing
ctioga -t 'Smoothing' --sort --smooth 3 noise.dat
Well, it cannot be perfect, can it ? Let’s compare the difference
ctioga -t 'Comparison' --sort -l 'Noise' noise.dat \
--smooth 3 -l 'Smoothing' noise.dat
Once set, a filter is applied to all the remaining plots. To remove the last
filter applied, use --filter-pop. To remove all of them, use --filter-clear.
Do not forget the order of application, for example you would better always
apply --sort first if necessary
ctioga -t 'Sorting second' \
-l 'Sorting second' --smooth 3 --sort noise.dat \
--filter-clear \
-l 'Sorting first' --sort --smooth 3 noise.dat
Histograms
Ctioga allows you to plot data (or math functions) in the form of histograms
with the --histogram switch
ctioga -t 'Cumulative distribution' \
--math --math-xrange 0:40 --yrange 1:4.5 --ylog \
-l 'data' \
--histogram --math-sample 21 'x**3-30*x**2+4100' \
-l 'fit' \
--no-histogram --math-sample 200 'x**3-30*x**2+4100'
Error bars
Soon to come, some possibility to add error bars for observers.