ctioga 1.11.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +340 -0
- data/ctioga/bin/ctable +28 -0
- data/ctioga/bin/ctioga +37 -0
- data/ctioga/doc/ctable.1 +156 -0
- data/ctioga/doc/ctioga.1 +2363 -0
- data/ctioga/examples/README +46 -0
- data/ctioga/examples/ctioga.gnuplot +4 -0
- data/ctioga/examples/ctioga_within_tioga.rb +53 -0
- data/ctioga/examples/ctiogarc.rb +24 -0
- data/ctioga/examples/include_1.rb +15 -0
- data/ctioga/examples/noise.dat +100 -0
- data/ctioga/examples/noise.rb +13 -0
- data/ctioga/examples/trig.csv +100 -0
- data/ctioga/examples/trig.dat +100 -0
- data/ctioga/examples/trig.rb +14 -0
- data/ctioga/examples/trigh.dat +100 -0
- data/ctioga/examples/trigh.rb +10 -0
- data/ctioga/examples/tutorial +763 -0
- data/ctioga/examples/tutorial.sh +269 -0
- data/ctioga/tests/README +14 -0
- data/ctioga/tests/axes.sh +40 -0
- data/ctioga/tests/basic.sh +11 -0
- data/ctioga/tests/draw.sh +24 -0
- data/ctioga/tests/histograms.sh +14 -0
- data/ctioga/tests/insets.sh +41 -0
- data/ctioga/tests/layouts.sh +29 -0
- data/ctioga/tests/legends.sh +113 -0
- data/ctioga/tests/styles.sh +43 -0
- data/ctioga/tests/test_style.sh +8 -0
- data/ctioga/tests/tests.sh +24 -0
- data/ctioga/tests/text_backend.sh +83 -0
- data/ctioga/tests/tioga_defaults.rb +18 -0
- data/lib/CTioga/axes.rb +904 -0
- data/lib/CTioga/backends.rb +88 -0
- data/lib/CTioga/boundaries.rb +224 -0
- data/lib/CTioga/ctable.rb +134 -0
- data/lib/CTioga/curve_style.rb +246 -0
- data/lib/CTioga/debug.rb +199 -0
- data/lib/CTioga/dimension.rb +133 -0
- data/lib/CTioga/elements.rb +17 -0
- data/lib/CTioga/elements/base.rb +84 -0
- data/lib/CTioga/elements/containers.rb +578 -0
- data/lib/CTioga/elements/curves.rb +368 -0
- data/lib/CTioga/elements/tioga_primitives.rb +440 -0
- data/lib/CTioga/layout.rb +595 -0
- data/lib/CTioga/legends.rb +29 -0
- data/lib/CTioga/legends/cmdline.rb +187 -0
- data/lib/CTioga/legends/item.rb +164 -0
- data/lib/CTioga/legends/style.rb +257 -0
- data/lib/CTioga/log.rb +73 -0
- data/lib/CTioga/movingarrays.rb +131 -0
- data/lib/CTioga/partition.rb +271 -0
- data/lib/CTioga/plot_style.rb +230 -0
- data/lib/CTioga/plotmaker.rb +1677 -0
- data/lib/CTioga/shortcuts.rb +69 -0
- data/lib/CTioga/structures.rb +82 -0
- data/lib/CTioga/styles.rb +140 -0
- data/lib/CTioga/themes.rb +581 -0
- data/lib/CTioga/themes/classical.rb +82 -0
- data/lib/CTioga/themes/demo.rb +63 -0
- data/lib/CTioga/themes/fits.rb +91 -0
- data/lib/CTioga/themes/mono.rb +33 -0
- data/lib/CTioga/tioga.rb +32 -0
- data/lib/CTioga/utils.rb +173 -0
- data/lib/MetaBuilder/Parameters/dates.rb +38 -0
- data/lib/MetaBuilder/Parameters/lists.rb +132 -0
- data/lib/MetaBuilder/Parameters/numbers.rb +69 -0
- data/lib/MetaBuilder/Parameters/strings.rb +86 -0
- data/lib/MetaBuilder/Parameters/styles.rb +75 -0
- data/lib/MetaBuilder/Qt4/Parameters/dates.rb +51 -0
- data/lib/MetaBuilder/Qt4/Parameters/numbers.rb +65 -0
- data/lib/MetaBuilder/Qt4/Parameters/strings.rb +106 -0
- data/lib/MetaBuilder/Qt4/parameter.rb +172 -0
- data/lib/MetaBuilder/Qt4/parameters.rb +9 -0
- data/lib/MetaBuilder/descriptions.rb +603 -0
- data/lib/MetaBuilder/factory.rb +101 -0
- data/lib/MetaBuilder/group.rb +57 -0
- data/lib/MetaBuilder/metabuilder.rb +10 -0
- data/lib/MetaBuilder/parameter.rb +374 -0
- data/lib/MetaBuilder/parameters.rb +11 -0
- data/lib/MetaBuilder/qt4.rb +8 -0
- data/lib/SciYAG/Backends/backend.rb +379 -0
- data/lib/SciYAG/Backends/binner.rb +168 -0
- data/lib/SciYAG/Backends/cache.rb +102 -0
- data/lib/SciYAG/Backends/dataset.rb +158 -0
- data/lib/SciYAG/Backends/descriptions.rb +469 -0
- data/lib/SciYAG/Backends/filters.rb +25 -0
- data/lib/SciYAG/Backends/filters/average.rb +134 -0
- data/lib/SciYAG/Backends/filters/cumulate.rb +37 -0
- data/lib/SciYAG/Backends/filters/filter.rb +70 -0
- data/lib/SciYAG/Backends/filters/norm.rb +39 -0
- data/lib/SciYAG/Backends/filters/smooth.rb +63 -0
- data/lib/SciYAG/Backends/filters/sort.rb +43 -0
- data/lib/SciYAG/Backends/filters/strip.rb +34 -0
- data/lib/SciYAG/Backends/filters/trim.rb +64 -0
- data/lib/SciYAG/Backends/gnuplot.rb +131 -0
- data/lib/SciYAG/Backends/math.rb +108 -0
- data/lib/SciYAG/Backends/mdb.rb +462 -0
- data/lib/SciYAG/Backends/multitext.rb +96 -0
- data/lib/SciYAG/Backends/source.rb +64 -0
- data/lib/SciYAG/Backends/text.rb +339 -0
- data/lib/SciYAG/backends.rb +16 -0
- metadata +191 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
# Small script for generating sine and cosine:
|
2
|
+
# use it this way:
|
3
|
+
# ruby trig.rb > trig.dat
|
4
|
+
|
5
|
+
# To generate the same but with csv data, use the following:
|
6
|
+
# ruby trig.rb | sed -r 's/[[:space:]]+/;/g' > trig.csv
|
7
|
+
|
8
|
+
|
9
|
+
include Math # can come in useful
|
10
|
+
|
11
|
+
100.times do |i|
|
12
|
+
x = (-PI + i * PI / 49.5).to_f
|
13
|
+
puts "#{x}\t#{sin(x)}\t#{cos(x)}\t#{sin(x/2.0)/5}"
|
14
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
-4.71238898038469 -0.917152335667274 -2.30129890230729
|
2
|
+
-4.61718920300318 -0.911962795826179 -2.22281992807806
|
3
|
+
-4.52198942562167 -0.906464045442052 -2.14657952077055
|
4
|
+
-4.42678964824016 -0.900639694677448 -2.07250089987198
|
5
|
+
-4.33158987085865 -0.894472744738396 -2.00050946197059
|
6
|
+
-4.23639009347715 -0.887945599708787 -1.93053270562375
|
7
|
+
-4.14119031609564 -0.881040084120858 -1.86250015834283
|
8
|
+
-4.04599053871413 -0.873737466959347 -1.79634330562156
|
9
|
+
-3.95079076133262 -0.866018492832175 -1.73199552193608
|
10
|
+
-3.85559098395111 -0.857863421069835 -1.66939200364745
|
11
|
+
-3.7603912065696 -0.849252073537055 -1.60846970373893
|
12
|
+
-3.66519142918809 -0.840163891951616 -1.5491672683223
|
13
|
+
-3.56999165180658 -0.830578005503796 -1.49142497484937
|
14
|
+
-3.47479187442507 -0.820473309553165 -1.4351846719663
|
15
|
+
-3.37959209704357 -0.809828556144359 -1.38038972095031
|
16
|
+
-3.28439231966206 -0.798622457026909 -1.3269849386697
|
17
|
+
-3.18919254228055 -0.786833799783009 -1.27491654200981
|
18
|
+
-3.09399276489904 -0.774441577558059 -1.22413209370887
|
19
|
+
-2.99879298751753 -0.761425132748937 -1.17458044954928
|
20
|
+
-2.90359321013602 -0.747764314831341 -1.12621170685104
|
21
|
+
-2.80839343275451 -0.73343965229808 -1.07897715421559
|
22
|
+
-2.713193655373 -0.718432538433136 -1.03282922246932
|
23
|
+
-2.61799387799149 -0.702725430361072 -0.987721436757379
|
24
|
+
-2.52279410060999 -0.686302060488436 -0.943608369739589
|
25
|
+
-2.42759432322848 -0.669147659095111 -0.900445595841306
|
26
|
+
-2.33239454584697 -0.651249186442792 -0.85818964651311
|
27
|
+
-2.23719476846546 -0.632595572350614 -0.816797966454314
|
28
|
+
-2.14199499108395 -0.613177960752033 -0.776228870756193
|
29
|
+
-2.04679521370244 -0.592989956302669 -0.736441502921768
|
30
|
+
-1.95159543632093 -0.57202786966815 -0.697395793719876
|
31
|
+
-1.85639565893942 -0.550290957698884 -0.659052420832072
|
32
|
+
-1.76119588155791 -0.527781654311782 -0.621372769251747
|
33
|
+
-1.66599610417641 -0.50450578756561 -0.584318892395562
|
34
|
+
-1.5707963267949 -0.480472778156452 -0.54785347388804
|
35
|
+
-1.47559654941339 -0.455695814392468 -0.511939789980835
|
36
|
+
-1.38039677203188 -0.430191998652027 -0.476541672568824
|
37
|
+
-1.28519699465037 -0.403982460404117 -0.441623472765773
|
38
|
+
-1.18999721726886 -0.377092431089443 -0.407150025002913
|
39
|
+
-1.09479743988735 -0.349551276535727 -0.373086611614244
|
40
|
+
-0.999597662505843 -0.321392483117054 -0.339398927872924
|
41
|
+
-0.904397885124335 -0.292653594564082 -0.306053047443517
|
42
|
+
-0.809198107742826 -0.263376097181849 -0.273015388215317
|
43
|
+
-0.713998330361316 -0.233605252219573 -0.240252678482332
|
44
|
+
-0.618798552979808 -0.203389875239204 -0.207731923435875
|
45
|
+
-0.523598775598299 -0.172782063516364 -0.17542037193601
|
46
|
+
-0.42839899821679 -0.141836873741898 -0.143285483528396
|
47
|
+
-0.333199220835281 -0.11061195353276 -0.111294895673309
|
48
|
+
-0.237999443453773 -0.079167131462267 -0.0794163911538371
|
49
|
+
-0.142799666072263 -0.0475639714357357 -0.0476178656304292
|
50
|
+
-0.0475998886907538 -0.0158652982233368 -0.0158672953091214
|
51
|
+
0.0475998886907547 0.0158652982233371 0.0158672953091217
|
52
|
+
0.142799666072263 0.0475639714357357 0.0476178656304292
|
53
|
+
0.237999443453772 0.0791671314622667 0.0794163911538368
|
54
|
+
0.333199220835281 0.11061195353276 0.111294895673309
|
55
|
+
0.42839899821679 0.141836873741898 0.143285483528396
|
56
|
+
0.523598775598298 0.172782063516364 0.17542037193601
|
57
|
+
0.618798552979808 0.203389875239204 0.207731923435875
|
58
|
+
0.713998330361316 0.233605252219573 0.240252678482332
|
59
|
+
0.809198107742825 0.263376097181848 0.273015388215317
|
60
|
+
0.904397885124335 0.292653594564082 0.306053047443517
|
61
|
+
0.999597662505844 0.321392483117054 0.339398927872924
|
62
|
+
1.09479743988735 0.349551276535727 0.373086611614244
|
63
|
+
1.18999721726886 0.377092431089443 0.407150025002913
|
64
|
+
1.28519699465037 0.403982460404117 0.441623472765773
|
65
|
+
1.38039677203188 0.430191998652027 0.476541672568824
|
66
|
+
1.47559654941339 0.455695814392468 0.511939789980835
|
67
|
+
1.5707963267949 0.480472778156452 0.54785347388804
|
68
|
+
1.66599610417641 0.50450578756561 0.584318892395562
|
69
|
+
1.76119588155791 0.527781654311782 0.621372769251747
|
70
|
+
1.85639565893942 0.550290957698884 0.659052420832072
|
71
|
+
1.95159543632093 0.57202786966815 0.697395793719876
|
72
|
+
2.04679521370244 0.592989956302669 0.736441502921768
|
73
|
+
2.14199499108395 0.613177960752033 0.776228870756192
|
74
|
+
2.23719476846546 0.632595572350614 0.816797966454314
|
75
|
+
2.33239454584697 0.651249186442792 0.85818964651311
|
76
|
+
2.42759432322848 0.669147659095111 0.900445595841306
|
77
|
+
2.52279410060998 0.686302060488436 0.943608369739588
|
78
|
+
2.61799387799149 0.702725430361072 0.98772143675738
|
79
|
+
2.713193655373 0.718432538433136 1.03282922246933
|
80
|
+
2.80839343275451 0.73343965229808 1.07897715421559
|
81
|
+
2.90359321013602 0.74776431483134 1.12621170685104
|
82
|
+
2.99879298751753 0.761425132748937 1.17458044954928
|
83
|
+
3.09399276489904 0.774441577558059 1.22413209370887
|
84
|
+
3.18919254228055 0.786833799783009 1.27491654200981
|
85
|
+
3.28439231966206 0.798622457026909 1.3269849386697
|
86
|
+
3.37959209704356 0.809828556144359 1.38038972095031
|
87
|
+
3.47479187442507 0.820473309553165 1.4351846719663
|
88
|
+
3.56999165180658 0.830578005503796 1.49142497484937
|
89
|
+
3.66519142918809 0.840163891951616 1.5491672683223
|
90
|
+
3.7603912065696 0.849252073537055 1.60846970373893
|
91
|
+
3.85559098395111 0.857863421069835 1.66939200364745
|
92
|
+
3.95079076133262 0.866018492832175 1.73199552193608
|
93
|
+
4.04599053871413 0.873737466959347 1.79634330562156
|
94
|
+
4.14119031609564 0.881040084120858 1.86250015834283
|
95
|
+
4.23639009347714 0.887945599708787 1.93053270562375
|
96
|
+
4.33158987085865 0.894472744738396 2.00050946197059
|
97
|
+
4.42678964824016 0.900639694677448 2.07250089987198
|
98
|
+
4.52198942562167 0.906464045442052 2.14657952077055
|
99
|
+
4.61718920300318 0.911962795826179 2.22281992807806
|
100
|
+
4.71238898038469 0.917152335667274 2.30129890230729
|
@@ -0,0 +1,763 @@
|
|
1
|
+
How to read this tutorial
|
2
|
+
=========================
|
3
|
+
|
4
|
+
This tutorial is willingly overdocumented so that each and everyone of you
|
5
|
+
could find whatever explanation they are looking for:
|
6
|
+
|
7
|
+
* if you just want to see what are the main features fo Ctioga, read through
|
8
|
+
and don't hesitate to copy/paste the example lines (don't forget to add
|
9
|
+
--xpdf, --open or --viewer YourFavoritePDFViewer to effectively look at the
|
10
|
+
produced graph) to get an idea;
|
11
|
+
|
12
|
+
* for those who are always in a hurry, the file tutorial.sh can be executed
|
13
|
+
to look at the results of all the examples in a row;
|
14
|
+
|
15
|
+
* if you are here because you don't understand one option or set of options,
|
16
|
+
just grep on it and you should find your way.
|
17
|
+
|
18
|
+
|
19
|
+
Here are the avalaible sections:
|
20
|
+
|
21
|
+
* Plotting math functions: where you will learn how to do some mathematics;
|
22
|
+
* Plotting simple data files: where you will play with data;
|
23
|
+
* Ruby Power: where you can use some very nice rubisms;
|
24
|
+
* Using presentation options: where you will learn how to customize your plot;
|
25
|
+
* Drawings: where you will know how to add some graphic materials;
|
26
|
+
* More words about backends: where other backends are described;
|
27
|
+
* Housekeeping and various options: where your won't forget your housekeeping
|
28
|
+
duties.
|
29
|
+
|
30
|
+
Have fun !
|
31
|
+
|
32
|
+
|
33
|
+
JJ Fleck 09/2006
|
34
|
+
|
35
|
+
|
36
|
+
Plotting math functions
|
37
|
+
=======================
|
38
|
+
|
39
|
+
Ctioga knows basic math function from which a lot can already be done.
|
40
|
+
Let's plot an exponential:
|
41
|
+
|
42
|
+
prompt> ctioga --math 'exp(x)'
|
43
|
+
|
44
|
+
Note that the variable in the function is always implicitly "x"
|
45
|
+
|
46
|
+
By the way, let's not forget to add some title via the --title (or -t) command
|
47
|
+
|
48
|
+
prompt> ctioga --math 'exp(x)' --title 'My exponential'
|
49
|
+
|
50
|
+
By default Ctioga assumes that the x-range is -10:10 and stretches the y-axes
|
51
|
+
so that the function is completely in the plot. A more "usual" way of looking
|
52
|
+
at exponentials could be
|
53
|
+
|
54
|
+
prompt> ctioga --math-xrange -5:1 --math 'exp(x)' -t 'My exponential'
|
55
|
+
|
56
|
+
Note that you have to use --math-xrange to get this behavior, the --xrange
|
57
|
+
option will only modify the plotting range but not the computing range, which
|
58
|
+
could lead to sampling problems. Compare
|
59
|
+
|
60
|
+
prompt> ctioga --xrange -1:1 --math 'sin(10 * x)' \
|
61
|
+
-t 'badly sampled sine'
|
62
|
+
|
63
|
+
and
|
64
|
+
|
65
|
+
prompt> ctioga --math-xrange -1:1 --math 'sin(10 * x)' \
|
66
|
+
-t 'well sampled sine'
|
67
|
+
|
68
|
+
From time to time, it can be very useful to define a function piece by piece:
|
69
|
+
|
70
|
+
prompt> ctioga --xrange -3:3 --math-xrange -2:0 --math 'x+1' \
|
71
|
+
--math-xrange 0:2 'exp(x)' \
|
72
|
+
-t 'Strange exponential'
|
73
|
+
|
74
|
+
Adding the --yrange option can be used to isolated a piece of graph
|
75
|
+
|
76
|
+
prompt> ctioga --yrange -2:8 --xrange -3:3 \
|
77
|
+
--math-xrange -2:0 --math 'x+1' \
|
78
|
+
--math-xrange 0:2 'exp(x)' \
|
79
|
+
-t 'Strange exponential'
|
80
|
+
|
81
|
+
Ctioga also knows about parametric functions, whenever you use the variable t,
|
82
|
+
|
83
|
+
prompt> ctioga --math --math-trange -3.1415:3.1415 \
|
84
|
+
'sin(2*t):cos(3*t)' \
|
85
|
+
-t 'parametric curve'
|
86
|
+
|
87
|
+
Note that you can use --math-trange to specifies the range over which to
|
88
|
+
compute the curve. As for --math-xrange, default is -10:10.
|
89
|
+
|
90
|
+
|
91
|
+
--include options allows you to define some functions so that ctioga could use
|
92
|
+
them. Look to file include_1.rb for an example of syntax. In this file is
|
93
|
+
defined the function pol(x) = (1.0 - x) * (1.0 + x) that we can use:
|
94
|
+
|
95
|
+
prompt> ctioga --include include_1.rb --math 'pol(x)' -t 'Polynomial function'
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
Plotting simple data files
|
100
|
+
==========================
|
101
|
+
|
102
|
+
Ctioga has been primarily intended to rapidly plot data files from the command
|
103
|
+
line. It's syntax is not far from the one used by gnuplot.
|
104
|
+
|
105
|
+
The simplest command (assuming you are in directory examples/ with datafile
|
106
|
+
trig.dat) is
|
107
|
+
|
108
|
+
prompt> ctioga trig.dat -t 'data sine'
|
109
|
+
|
110
|
+
which plot column 2 with respect to column 1 and automaticaly set the width
|
111
|
+
and height of the plot, give the legend with respect to the filename
|
112
|
+
|
113
|
+
If you append an other file name (for example trigh.dat for some hyperbolic
|
114
|
+
trigonometry):
|
115
|
+
|
116
|
+
prompt> ctioga trig.dat trigh.dat -t 'data sine and hyperbolic tangente'
|
117
|
+
|
118
|
+
it will plot the two dataset on the same plot (with different colors and
|
119
|
+
legends) and adapt automatically the extension to the biggest x and y used so
|
120
|
+
that both dataset are completely visible on the graph
|
121
|
+
|
122
|
+
Let's see how to change the columns we would like to use.
|
123
|
+
|
124
|
+
To plot the third column rather than the second one, you use
|
125
|
+
|
126
|
+
prompt> ctioga trig.dat@1:3 -t 'data cosine'
|
127
|
+
|
128
|
+
Or to plot a circle with parametric representation
|
129
|
+
|
130
|
+
prompt> ctioga trig.dat@2:3 -t 'Circle'
|
131
|
+
|
132
|
+
|
133
|
+
Note that if there is no filename before the "@", the previous file is used
|
134
|
+
instead:
|
135
|
+
|
136
|
+
prompt> ctioga trig.dat @1:3 @2:3 -t 'Some trigonometry'
|
137
|
+
|
138
|
+
plots the sine (which is implicitly @1:2), the cosine (@1:3) and the circle
|
139
|
+
(@2:3)
|
140
|
+
|
141
|
+
If you add the other file, depending on where you put it, the results will
|
142
|
+
change.
|
143
|
+
|
144
|
+
Compare
|
145
|
+
|
146
|
+
prompt> ctioga trig.dat trigh.dat @1:3 @2:3 -t 'Mixing 1'
|
147
|
+
|
148
|
+
prompt> ctioga trig.dat @1:3 trigh.dat @2:3 -t 'Mixing 2'
|
149
|
+
|
150
|
+
prompt> ctioga trig.dat @1:3 @2:3 trigh.dat -t 'Mixing 3'
|
151
|
+
|
152
|
+
To put some legends, use the --legend (or -l) option. Don't forget to protect
|
153
|
+
your legend with simple quotes as in 'my legend' whenever it contains spaces
|
154
|
+
or things that could be interpreted by your shell. Bear also in mind that it
|
155
|
+
will finally get passed to LaTeX, so use "^" and "_" with caution.
|
156
|
+
|
157
|
+
prompt> ctioga --legend sine trig.dat \
|
158
|
+
-l cosine @1:3 \
|
159
|
+
-l 'beautiful circle' @2:3 \
|
160
|
+
-t 'Some trigonometry'
|
161
|
+
|
162
|
+
You can also use LaTeX coding in your legends
|
163
|
+
|
164
|
+
prompt> ctioga -l '$\sin(x)$' trig.dat \
|
165
|
+
-l '$\cos(x)$' @1:3 \
|
166
|
+
-l '$r = \sqrt{\cos^2(x) + \sin^2(x)} = 1$' @2:3 \
|
167
|
+
-t 'Some trigonometry'
|
168
|
+
|
169
|
+
Data files and expansion
|
170
|
+
------------------------
|
171
|
+
|
172
|
+
Ctioga has a feature for automatic data set expansion. When you're interested
|
173
|
+
to plot several columns of one file as a function of only one column, it is
|
174
|
+
interesting to use the 2##4 syntax. file.dat@2##4 is exactly equivalent to
|
175
|
+
file.dat@1:2 file.dat@1:3 file.dat@1:4. This can reduce quite a bit the
|
176
|
+
tediousness that can come sometimes...
|
177
|
+
|
178
|
+
prompt> ctioga -t 'Use of expansion' trig.dat@1:2##3
|
179
|
+
|
180
|
+
Starting from ctioga 1.3, you can use tis mechanism as well for nearly
|
181
|
+
any backend, including the --math one:
|
182
|
+
|
183
|
+
prompt> ctioga -t 'Math and expansion' --math 'sin(x + 1##4)'
|
184
|
+
|
185
|
+
Filters
|
186
|
+
-------
|
187
|
+
|
188
|
+
Ctioga also have some filters you can apply to your data.
|
189
|
+
|
190
|
+
From time to time, data are not computed in the way we would like to. For
|
191
|
+
example
|
192
|
+
|
193
|
+
prompt> ctioga -t 'Unsorted' noise.dat
|
194
|
+
|
195
|
+
That's why Ctioga comes with the --sort filter
|
196
|
+
|
197
|
+
prompt> ctioga -t 'Sorted' --sort noise.dat
|
198
|
+
|
199
|
+
That's better. But it is quite hard to recognize the cosine underneath the
|
200
|
+
noise. Let's apply some smoothing
|
201
|
+
|
202
|
+
prompt> ctioga -t 'Smoothing' --sort --smooth 3 noise.dat
|
203
|
+
|
204
|
+
Well, it cannot be perfect, can it ? Let's compare the difference
|
205
|
+
|
206
|
+
prompt> ctioga -t 'Comparison' --sort -l 'Noise' noise.dat \
|
207
|
+
--smooth 3 -l 'Smoothing' noise.dat
|
208
|
+
|
209
|
+
Once set, a filter is applied to all the remaining plots. To remove the last
|
210
|
+
filter applied, use --filter-pop. To remove all of them, use --filter-clear.
|
211
|
+
Do not forget the order of application, for example you would better always
|
212
|
+
apply --sort first if necessary
|
213
|
+
|
214
|
+
prompt> ctioga -t 'Sorting second' \
|
215
|
+
-l 'Sorting second' --smooth 3 --sort noise.dat \
|
216
|
+
--filter-clear \
|
217
|
+
-l 'Sorting first' --sort --smooth 3 noise.dat
|
218
|
+
|
219
|
+
Histograms
|
220
|
+
----------
|
221
|
+
|
222
|
+
Ctioga allows you to plot data (or math functions) in the form of histograms
|
223
|
+
with the --histogram switch
|
224
|
+
|
225
|
+
prompt> ctioga -t 'Cumulative distribution' \
|
226
|
+
--math --math-xrange 0:40 --yrange 1:4.5 --ylog \
|
227
|
+
-l 'data' \
|
228
|
+
--histogram --math-sample 21 'x**3-30*x**2+4100' \
|
229
|
+
-l 'fit' \
|
230
|
+
--no-histogram --math-sample 200 'x**3-30*x**2+4100'
|
231
|
+
|
232
|
+
Error bars
|
233
|
+
----------
|
234
|
+
|
235
|
+
Soon to come, some possibility to add error bars for observers.
|
236
|
+
|
237
|
+
|
238
|
+
Ruby Power
|
239
|
+
==========
|
240
|
+
|
241
|
+
As Ctioga is written in Ruby and is internally letting Ruby take care of most
|
242
|
+
of the computations, you can use your knowledge in Ruby to improve your plots.
|
243
|
+
Let's suppose for example that you are only interested in the function
|
244
|
+
gathering the maximum value of two of your data columns. You can use the .max
|
245
|
+
method implemented for all 'Enumerable' you find in Ruby, for example Arrays:
|
246
|
+
|
247
|
+
prompt> ctioga -t 'Everybody likes to go there' \
|
248
|
+
-l 'Max value' \
|
249
|
+
trig.dat@'$1:[$2,$3].max'
|
250
|
+
|
251
|
+
Sure enough, you can also use the .min method.
|
252
|
+
|
253
|
+
|
254
|
+
What if you would like to put some conditions on plotted points ? You just
|
255
|
+
have to use some 'if' statements
|
256
|
+
|
257
|
+
prompt> ctioga -t 'First and third quarter' \
|
258
|
+
-l 'Conditionnal drawing' \
|
259
|
+
trig.dat@'$2:(if $3*$2 > 0 ; $3 else 0.0/0.0 ; end)'
|
260
|
+
|
261
|
+
Note the use of 0.0/0.0 to get a NaN which will not be drawn.
|
262
|
+
|
263
|
+
If you are curious of the Dvectors defined by Tioga and extensively used by
|
264
|
+
Ctioga, you can also use some of their power to speed up computation or simply
|
265
|
+
writing. For example to sum the squared roots of 3 curves
|
266
|
+
|
267
|
+
prompt> ctioga -t 'Square root summation' \
|
268
|
+
-N trig.dat@'$1:sqrt($2##4)' \
|
269
|
+
-l 'Sum using Dvectors' \
|
270
|
+
trig.dat@'$1:Dvector[$2,$3,$4].safe_sqrt.sum'
|
271
|
+
|
272
|
+
You can find many more Dvector's shortcuts on the dedicated web page, looking
|
273
|
+
for "Dobjects:Dvector" in the central frame:
|
274
|
+
|
275
|
+
http://theory.kitp.ucsb.edu/~paxton/tioga_doc/
|
276
|
+
|
277
|
+
Using presentation options
|
278
|
+
==========================
|
279
|
+
|
280
|
+
Let's go towards more aesthetic considerations.
|
281
|
+
|
282
|
+
Depending on what you plot, external presentation will differ. We have already
|
283
|
+
seen how to add title (introduced by --title or -t) and legends (introduced by
|
284
|
+
-l or --legend) to the plot. Note that --title is a global setting. As there
|
285
|
+
is only one title for the entire plot, it can be specified wherever you want
|
286
|
+
whereas the legend acts on a given dataset or function and has to be specified
|
287
|
+
just before the curve on which it will apply. This consideration holds true
|
288
|
+
for most of the options we will present in this section as they generally
|
289
|
+
apply to a given curve.
|
290
|
+
|
291
|
+
Particular options
|
292
|
+
------------------
|
293
|
+
|
294
|
+
Red is not your favorite color ? You have a lot more choice.. You just have to
|
295
|
+
introduce the --color or -c options before the plot you would like to colorize
|
296
|
+
|
297
|
+
prompt> ctioga --color Violet trig.dat \
|
298
|
+
-c Blue @1:3 \
|
299
|
+
-c Turquoise @2:3 \
|
300
|
+
-c PowderBlue trigh.dat \
|
301
|
+
-t 'Blue tones'
|
302
|
+
|
303
|
+
The complete set of available colors can be found in the Tioga documentation
|
304
|
+
at
|
305
|
+
|
306
|
+
http://theory.kitp.ucsb.edu/~paxton/tioga_doc/classes/Tioga/ColorConstants.html
|
307
|
+
|
308
|
+
Background color could also be specified using the --background option to make
|
309
|
+
plots less crude
|
310
|
+
|
311
|
+
prompt> ctioga --background Ivory trig.dat -l 'Ivory background'
|
312
|
+
|
313
|
+
Well, colors are a great thing but for use on a B&W printer, you would
|
314
|
+
certainly prefer some black color and different linestyle:
|
315
|
+
use the --mono switch
|
316
|
+
|
317
|
+
prompt> ctioga --mono trig.dat @1:3 @2:3 -t 'Black trigonometry'
|
318
|
+
|
319
|
+
But what if the Ctioga's default for linestyle are not the one you would
|
320
|
+
expect ? Just change them:
|
321
|
+
|
322
|
+
prompt> ctioga --line-style Line_Type_Dot trig.dat \
|
323
|
+
--line-style Line_Type_Dash @2:3 \
|
324
|
+
--line-style Line_Type_Dot_Long_Dash @1:3 \
|
325
|
+
-t 'Some line types'
|
326
|
+
|
327
|
+
Once again, line types are derived from those of tioga. You can find the
|
328
|
+
complete set and an explication how to define it yourself at
|
329
|
+
|
330
|
+
http://theory.kitp.ucsb.edu/~paxton/tioga_doc/classes/Tioga/Strokes.html
|
331
|
+
|
332
|
+
Note that line-style is a switch. Every coming curve will have the
|
333
|
+
last-defined line-type, even if you switch to --mono
|
334
|
+
|
335
|
+
One curve could be more important than an other, a way of underlining it is to
|
336
|
+
play on line-width.
|
337
|
+
|
338
|
+
prompt> ctioga --line-width 0.5 trig.dat @1:3 \
|
339
|
+
--line-width 2 @2:3 \
|
340
|
+
-t 'See the circle ?'
|
341
|
+
|
342
|
+
Just as --line-style, it has an influence over all coming curves until an
|
343
|
+
other --line-width is issued.
|
344
|
+
|
345
|
+
What about plotting real data and trying to fit some model on it. Well Ctioga
|
346
|
+
has no fitting routine as it only concerns plotting (but who knows,
|
347
|
+
one day..?). Nevertheless, you can use your favorite tool to find the fitting
|
348
|
+
parameters and Ctioga to plot the result:
|
349
|
+
|
350
|
+
prompt> ctioga -l 'model' --math --xrange -4:4 'sin(x)' \
|
351
|
+
-l 'data' --text --marker Plus --line-width 0 trig.dat \
|
352
|
+
-t 'comparison data/model'
|
353
|
+
|
354
|
+
Note that you switch back from math mode to data-reading mode with the switch
|
355
|
+
--text (because datas are in a text file). Once again, the list of available
|
356
|
+
markers (including Cross, Diamond, Semicircle but also Arrow, Hand or Check)
|
357
|
+
is available here:
|
358
|
+
|
359
|
+
http://theory.kitp.ucsb.edu/~paxton/tioga_doc/classes/Tioga/MarkerConstants.html
|
360
|
+
|
361
|
+
If you like, you can also have the markers of a different color than the
|
362
|
+
underlying curve:
|
363
|
+
|
364
|
+
prompt> ctioga --marker Plus --marker-color Blue trig.dat \
|
365
|
+
-t 'Bicolored graph'
|
366
|
+
|
367
|
+
Global options
|
368
|
+
--------------
|
369
|
+
|
370
|
+
Together with --title, there is two other global settings, namely --xlabel
|
371
|
+
(or�-x) to specify the label of the x axis and --ylabel (or -y) for the y one.
|
372
|
+
You can call them wherever you want. For example, a plot of x = cos(t) could
|
373
|
+
be written as
|
374
|
+
|
375
|
+
prompt> ctioga -l '$x = \cos(t)$' --math 'cos(x)' -x '$t$' -y '$x$' \
|
376
|
+
-t 'Evolution of position $x$ in time'
|
377
|
+
|
378
|
+
By default, Ctioga produces squared plots, which is useful for inclusion in
|
379
|
+
2 columns papers but not that good-looking for oral presentation. To correct
|
380
|
+
this, you have the switch --golden-ratio to set the ratio of height to length
|
381
|
+
to the well known (1 + sqrt(5))/2:
|
382
|
+
|
383
|
+
prompt> ctioga trig.dat @1:3 @2:3 -t 'Gold trigonometry' --golden-ratio
|
384
|
+
|
385
|
+
Or you can define this ratio yourself
|
386
|
+
|
387
|
+
prompt> ctioga trig.dat @1:3 @2:3 \
|
388
|
+
-t 'Silver trigonometry' \
|
389
|
+
--aspect-ratio 2
|
390
|
+
|
391
|
+
prompt> ctioga trig.dat @1:3 @2:3 \
|
392
|
+
-t 'Bronze trigonometry' \
|
393
|
+
--aspect-ratio 0.5
|
394
|
+
|
395
|
+
Options --xrange and --yrange that we met at the beginning of this tutorial
|
396
|
+
come with the option --margin which gives an extra space (0.1 represents 10%)
|
397
|
+
around the curve so that it does not touch the borders
|
398
|
+
|
399
|
+
prompt> ctioga trig.dat --margin 0.1 \
|
400
|
+
-t '10\% air on both sides'
|
401
|
+
|
402
|
+
If you want only air around the vertical side, use in conjonction with
|
403
|
+
--xrange
|
404
|
+
|
405
|
+
prompt> ctioga trig.dat --margin 0.1 --xrange -3.14:3.14 \
|
406
|
+
-t '10\% air on vertical side'
|
407
|
+
|
408
|
+
Ctioga automaticaly choose some set of colors if none is defined on the line.
|
409
|
+
You can change it if it does not fit your requirement. Currently available
|
410
|
+
sets are "default" and "colorblind"
|
411
|
+
|
412
|
+
prompt> ctioga trig.dat @1:3 @2:3 trigh.dat @1:3 @2:3 \
|
413
|
+
-t 'default color-set'
|
414
|
+
|
415
|
+
prompt> ctioga --color-set colorblind \
|
416
|
+
trig.dat @1:3 @2:3 trigh.dat @1:3 @2:3 \
|
417
|
+
-t 'colorblind color-set'
|
418
|
+
|
419
|
+
You can also use the "gradient" feature, for example going from Blue to Red in
|
420
|
+
6 steps
|
421
|
+
|
422
|
+
prompt> ctioga --color-set gradient:Blue--Red,6 \
|
423
|
+
trig.dat @1:3 @2:3 trigh.dat @1:3 @2:3 \
|
424
|
+
-t 'Gradient feature with 6 steps'
|
425
|
+
|
426
|
+
With less steps, the colors repeat itself
|
427
|
+
|
428
|
+
prompt> ctioga --color-set gradient:Blue--Red,3 \
|
429
|
+
trig.dat @1:3 @2:3 trigh.dat @1:3 @2:3 \
|
430
|
+
-t 'Gradient feature with 3 steps'
|
431
|
+
|
432
|
+
The same is true for markers and line-types but for the moment, only the
|
433
|
+
"default" is available. If you have ideas of sets, just email them to us and
|
434
|
+
we will be happy to add them.
|
435
|
+
|
436
|
+
prompt> ctioga -m --marker-set default trig.dat @1:3 @2:3 \
|
437
|
+
-t 'Using Markers'
|
438
|
+
|
439
|
+
prompt> ctioga --mono --line-style-set standard trig.dat @1:3 @2:3 \
|
440
|
+
-t 'Using line-styles (which is already the default...)'
|
441
|
+
|
442
|
+
Finally, you can also have a different set of colors for you markers
|
443
|
+
|
444
|
+
prompt> ctioga -m --marker-set default \
|
445
|
+
--marker-color-set colorblind \
|
446
|
+
trig.dat @1:3 @2:3 \
|
447
|
+
-t 'Using Markers'
|
448
|
+
|
449
|
+
Axis manipulation
|
450
|
+
-----------------
|
451
|
+
|
452
|
+
Logarithmic axes can be specified *at the beginning of the plot* with options
|
453
|
+
--xlog and --ylog. In this case, an exponential looks like a mere right line
|
454
|
+
|
455
|
+
prompt> ctioga --ylog --math 'exp(x)' -t 'Some straight line'
|
456
|
+
|
457
|
+
prompt> ctioga --xlog --ylog --math-xrange 0.001:1000 \
|
458
|
+
--math '1/x**2' '1/x**3' -t 'Power laws'
|
459
|
+
|
460
|
+
One astrophysical example of such a use is the stellar Initial Mass Function
|
461
|
+
(IMF) which is known to be a power law by pieces
|
462
|
+
|
463
|
+
prompt> ctioga --xlog --ylog --math \
|
464
|
+
--math-xrange 0.1:1 -l 'Low masses' '1/x**1.3' \
|
465
|
+
--math-xrange 1:10 -l 'Intermediate masses' '1/x**2.35' \
|
466
|
+
--math-xrange 10:100 -l 'High masses' '1/x**4*10**1.65' \
|
467
|
+
-x '$\log_{10}(M/M_\odot)$' -y '$\log_{10}(dN/dM)$' \
|
468
|
+
-t 'Kroupa IMF' --golden-ratio
|
469
|
+
|
470
|
+
There is one detail you have to be careful at: the corresponding range has to
|
471
|
+
be given in logscale also. For example, if you want to plot the previous
|
472
|
+
figure between 0.01 and 1000, you have to specify --xrange -2:3 rather than
|
473
|
+
--xrange 0.01:1000
|
474
|
+
|
475
|
+
prompt> ctioga --xlog --ylog --xrange -2:3 --math \
|
476
|
+
--math-xrange 0.1:1 -l 'Low masses' '1/x**1.3' \
|
477
|
+
--math-xrange 1:10 -l 'Intermediate masses' '1/x**2.35' \
|
478
|
+
--math-xrange 10:100 -l 'High masses' '1/x**4*10**1.65' \
|
479
|
+
-x '$\log_{10}(M/M_\odot)$' -y '$\log_{10}(dN/dM)$' \
|
480
|
+
-t 'Kroupa IMF' --golden-ratio
|
481
|
+
|
482
|
+
|
483
|
+
From time to time, it can also be useful to stretch or shrink axes by a given
|
484
|
+
factor, for example in a fitting purpose or to compare two set of data that do
|
485
|
+
note have the scale. Use --xfact and --yfact. Compare
|
486
|
+
|
487
|
+
prompt> ctioga trig.dat @1:4 -t 'Scaling problem'
|
488
|
+
|
489
|
+
prompt> ctioga trig.dat --xfact 0.5 --yfact 5 @1:4 -t 'Scaling resolved'
|
490
|
+
|
491
|
+
Drawings
|
492
|
+
========
|
493
|
+
|
494
|
+
From time to time, you will certainly need to add text, arrows or markers at
|
495
|
+
some points in you plot. Let's consider the physical case of the discharge of
|
496
|
+
a capacity C in a resistor R so that RC=2. Normally, it's simply an
|
497
|
+
exponential decay
|
498
|
+
|
499
|
+
prompt> ctioga -t 'RC circuit decay' -N --math --math-xrange 0:9 \
|
500
|
+
-x '$t$' -y '$U_C$' \
|
501
|
+
'exp(-x/2)' --yrange 0:1
|
502
|
+
|
503
|
+
Arrow
|
504
|
+
-----
|
505
|
+
|
506
|
+
Cool.. But well, it's a bit cheap, isn't it ? Let's add some graphical
|
507
|
+
information. For example, after 3RC, the discharge is complete at 95% and so
|
508
|
+
let's draw an arrow to highlight this position
|
509
|
+
|
510
|
+
prompt> ctioga -t 'RC circuit decay' -N --math --math-xrange 0:9 \
|
511
|
+
-x '$t$' -y '$U_C$' \
|
512
|
+
'exp(-x/2)' --yrange 0:1 \
|
513
|
+
--draw "arrow: 6,0.2 6,0.07"
|
514
|
+
|
515
|
+
To do this, we used the --draw switch followed by the keyword "arrow" and the
|
516
|
+
indication of its origin (6,0.2) and target (6,0.07). The head and tail of the
|
517
|
+
arrow are usually too big, so we will use options in the form "option=value"
|
518
|
+
to get it right
|
519
|
+
|
520
|
+
prompt> ctioga -t 'RC circuit decay' -N --math --math-xrange 0:9 \
|
521
|
+
-x '$t$' -y '$U_C$' \
|
522
|
+
'exp(-x/2)' --yrange 0:1 \
|
523
|
+
--draw "arrow: 6,0.2 6,0.07 tail_scale=0.1 head_scale=0.5"
|
524
|
+
|
525
|
+
Other valid options are
|
526
|
+
|
527
|
+
* "tail_marker" and "head_marker" to change the default markers used. The
|
528
|
+
given value should be a valid Tioga Marker ;
|
529
|
+
* "line_style" which value should be a valid Tioga Line_Type as given on page
|
530
|
+
|
531
|
+
http://theory.kitp.ucsb.edu/~paxton/tioga_doc/classes/Tioga/Strokes.html
|
532
|
+
|
533
|
+
* "line_width" which specify the width of the arrow line ;
|
534
|
+
* and finally "color" to change the color of the arrow.
|
535
|
+
|
536
|
+
Text
|
537
|
+
----
|
538
|
+
|
539
|
+
Well, we stil have to say why we draw this arrow. Let's use the keyword "text"
|
540
|
+
to do that for which you have to give the application point and the text to
|
541
|
+
add
|
542
|
+
|
543
|
+
prompt> ctioga -t 'RC circuit decay' -N --math --math-xrange 0:9 \
|
544
|
+
-x '$t$' -y '$U_C$' \
|
545
|
+
'exp(-x/2)' --yrange 0:1 \
|
546
|
+
--draw "arrow: 6,0.2 6,0.07 tail_scale=0.1 head_scale=0.5" \
|
547
|
+
--draw "text: 6,0.22 '\$95\\%\$ decay'"
|
548
|
+
|
549
|
+
Note that due to multiple evaluation, you have to specify escape caracters for
|
550
|
+
"$" and "\" so that LaTeX really see $95\%$.
|
551
|
+
|
552
|
+
Tangent
|
553
|
+
-------
|
554
|
+
|
555
|
+
If you would like to add an arrow on a curve, the "tangent" keyword will do
|
556
|
+
it. It is basically an arrow and so share the same options. But the position
|
557
|
+
indication is the fraction of the data vector to place it. For example, if you
|
558
|
+
have 200 data points, specifiing 0.35 will put the tangent where the 70th
|
559
|
+
data point is located. This has to be done that way because a curve can go
|
560
|
+
back and forth and only the position into the data structure can help to
|
561
|
+
define uniquely where the tangent should apply. Here we will indicate the
|
562
|
+
direction of decay in the middle of the graph
|
563
|
+
|
564
|
+
prompt> ctioga -t 'RC circuit decay' -N --math --math-xrange 0:9 \
|
565
|
+
-x '$t$' -y '$U_C$' \
|
566
|
+
'exp(-x/2)' --yrange 0:1 \
|
567
|
+
--draw "arrow: 6,0.2 6,0.07 tail_scale=0.1 head_scale=0.5" \
|
568
|
+
--draw "text: 6,0.22 '\$95\\%\$ decay'" \
|
569
|
+
--draw "tangent: 0.5 head_scale=0.7"
|
570
|
+
|
571
|
+
|
572
|
+
What is interesting to discover in our physical problem is the value of RC
|
573
|
+
which is given by the intersection of the tangent at the origin with the x
|
574
|
+
axis. We can then use the option xextent or yextent. But now, to be able to
|
575
|
+
compute properly the tangent at the origin, we have to extent the definition
|
576
|
+
domain of our exponential, for example from -1 to get a simple position of the
|
577
|
+
"0" value at 0.1=(0-(-1))/(9-(-1))
|
578
|
+
|
579
|
+
prompt> ctioga -t 'RC circuit decay' -N --math --math-xrange -1:9 \
|
580
|
+
-x '$t$' -y '$U_C$' \
|
581
|
+
'exp(-x/2)' --yrange 0:1 --xrange 0:9 \
|
582
|
+
--draw "arrow: 6,0.2 6,0.07 tail_scale=0.1 head_scale=0.5" \
|
583
|
+
--draw "text: 6,0.22 '\$95\\%\$ decay'" \
|
584
|
+
--draw "tangent: 0.5 head_scale=0.7" \
|
585
|
+
--draw "tangent: 0.1 head_scale=0.1 xextent=2 color=Black"
|
586
|
+
|
587
|
+
|
588
|
+
We could also have used the "yextent" option, but there we have to go towards
|
589
|
+
the negative values
|
590
|
+
|
591
|
+
prompt> ctioga -t 'RC circuit decay' -N --math --math-xrange -1:9 \
|
592
|
+
-x '$t$' -y '$U_C$' \
|
593
|
+
'exp(-x/2)' --yrange 0:1 --xrange 0:9 \
|
594
|
+
--draw "arrow: 6,0.2 6,0.07 tail_scale=0.1 head_scale=0.5" \
|
595
|
+
--draw "text: 6,0.22 '\$95\\%\$ decay'" \
|
596
|
+
--draw "tangent: 0.5 head_scale=0.7" \
|
597
|
+
--draw "tangent: 0.1 head_scale=0.1 yextent=-1 color=Black"
|
598
|
+
|
599
|
+
Marker
|
600
|
+
------
|
601
|
+
|
602
|
+
Finally, let's add some text on this tangent using the respective options
|
603
|
+
|
604
|
+
prompt> ctioga -t 'RC circuit decay' -N --math --math-xrange -1:9 \
|
605
|
+
-x '$t$' -y '$U_C$' \
|
606
|
+
'exp(-x/2)' --yrange 0:1 --xrange 0:9 \
|
607
|
+
--draw "arrow: 6,0.2 6,0.07 tail_scale=0.1 head_scale=0.5" \
|
608
|
+
--draw "text: 6,0.22 '\$95\\%\$ decay'" \
|
609
|
+
--draw "tangent: 0.5 head_scale=0.7" \
|
610
|
+
--draw "tangent: 0.1 head_scale=0.1 yextent=-1 color=Black" \
|
611
|
+
--draw "text: 1.9,0.15 '\$\\tau=RC\$' \
|
612
|
+
angle=-77 scale=2 color=Blue"
|
613
|
+
|
614
|
+
and a funny marker using the "marker" keyword
|
615
|
+
|
616
|
+
prompt> ctioga -t 'RC circuit decay' -N --math --math-xrange -1:9 \
|
617
|
+
-x '$t$' -y '$U_C$' \
|
618
|
+
'exp(-x/2)' --yrange 0:1 --xrange 0:9 \
|
619
|
+
--draw "arrow: 6,0.2 6,0.07 tail_scale=0.1 head_scale=0.5" \
|
620
|
+
--draw "text: 6,0.22 '\$95\\%\$ decay'" \
|
621
|
+
--draw "tangent: 0.5 head_scale=0.7" \
|
622
|
+
--draw "tangent: 0.1 head_scale=0.1 yextent=-1 color=Black" \
|
623
|
+
--draw "text: 1.9,0.15 '\$\\tau=RC\$' \
|
624
|
+
angle=-77 scale=2 color=Blue" \
|
625
|
+
--draw "marker: 1.5,0.05 OtherHand \
|
626
|
+
angle=-45 scale=2 color=Blue"
|
627
|
+
|
628
|
+
A reminder of all the options and drawing abilities can be found using the
|
629
|
+
--draw-help option on the command line.
|
630
|
+
|
631
|
+
|
632
|
+
More words about backends
|
633
|
+
=========================
|
634
|
+
|
635
|
+
In the first two paragraphs, we have talked much about --math and --text
|
636
|
+
modes. We believe that these two modes (these two backends as we will call
|
637
|
+
them from now on) will be the two more useful ones. But if you ever feel
|
638
|
+
limited by them, you can just write your own and experience the power of ruby.
|
639
|
+
Vince for example wrote two backends (--mdb and --mdbcv) that you would
|
640
|
+
probably never use because they are especially made for his experiments
|
641
|
+
results. Nevertheless, you can take example on them to fit your special needs
|
642
|
+
by for example automaticaly retrieving informations in the headers.
|
643
|
+
|
644
|
+
Multitext Backend
|
645
|
+
-----------------
|
646
|
+
|
647
|
+
My own codes are producing a lot of outputs that I have to split into several
|
648
|
+
files to ease their use. Nevertheless, I would like from time to time to plot
|
649
|
+
one column of one file as a function of a column in another file or even make
|
650
|
+
some mathematical manipulations of columns that don't live in the same files.
|
651
|
+
So I wrote the multitext backend to do so. The syntax is a bit rigid for now,
|
652
|
+
but it could come useful one day. Basically, you can write things as
|
653
|
+
|
654
|
+
prompt> ctioga --multitext '[trig.dat@2]:[trigh.dat@2]' \
|
655
|
+
-t "two files in one plot"
|
656
|
+
|
657
|
+
The syntax is necessarily of the type [filename@column_number] within square
|
658
|
+
brackets. Sure enough, the files have to have the same number of lines and be
|
659
|
+
somehow related (but this becomes your problem now :o). Any mathematical
|
660
|
+
expression is then possible
|
661
|
+
|
662
|
+
prompt> ctioga --multitext '[trig.dat@2]:[trigh.dat@2] + [trig.dat@3]' \
|
663
|
+
-t "Some computation on different files"
|
664
|
+
|
665
|
+
prompt> ctioga --multitext '[trig.dat@2]**2:[trigh.dat@2] * [trig.dat@3]'\
|
666
|
+
-t "Some more computation on different files"
|
667
|
+
|
668
|
+
CSV files
|
669
|
+
---------
|
670
|
+
|
671
|
+
Starting from ctioga 1.3, it is now possible to specify arbitrary column
|
672
|
+
separators for the --text backend. This makes it possible to now parse
|
673
|
+
CSV (comma-separated values) files, such as the trig.csv file included
|
674
|
+
in the archive:
|
675
|
+
|
676
|
+
prompt> ctioga --text-separator ';' trig.csv -t "CSV trigonometry"
|
677
|
+
|
678
|
+
Housekeeping and various options
|
679
|
+
================================
|
680
|
+
|
681
|
+
The coming options do not directly apply to the plot, but more to the material
|
682
|
+
living of the plots, how to view it, how to share it with others, how to
|
683
|
+
include it in a TeX file and so on. So there will be no more example, just a
|
684
|
+
description of what the option does effectively:
|
685
|
+
|
686
|
+
Shell Variable
|
687
|
+
--------------
|
688
|
+
|
689
|
+
Ctioga naturally look into the content of the shell variable CTIOGA that you
|
690
|
+
can define in your prefferred shell starting file. For example, the script
|
691
|
+
tutorial.sh begins with
|
692
|
+
|
693
|
+
prompt> CTIOGA="--xpdf --clean-all --display-commandline" \
|
694
|
+
export CTIOGA
|
695
|
+
|
696
|
+
and thus every ctioga call will be prepended by this set of commands. A wise
|
697
|
+
idea is to set it to "--xpdf" as this options will be the most commonly
|
698
|
+
forgotten.
|
699
|
+
|
700
|
+
Viewing
|
701
|
+
-------
|
702
|
+
|
703
|
+
You can choose to view the resulting pdf file with the viewer you cherish with
|
704
|
+
the --viewer option. For example
|
705
|
+
|
706
|
+
prompt> ctioga --viewer gv trig.dat
|
707
|
+
|
708
|
+
--xpdf and --open are short cuts to using xpdf or open (for MacOSX users,
|
709
|
+
which has the same effect as double clicking on the selected file) as viewers.
|
710
|
+
|
711
|
+
--no-viewer avoid a viewer to be opened even if you CTIOGA variable is set to
|
712
|
+
--xpdf
|
713
|
+
|
714
|
+
Cleaning
|
715
|
+
--------
|
716
|
+
|
717
|
+
Ctioga produce a lot af auxilliary files in order to produce the final pdf
|
718
|
+
version of your plot. Most of the time, you will only need the pdf file so
|
719
|
+
that option --cleanup will erase every other files that have been created.
|
720
|
+
|
721
|
+
Nevertheless, when you will need to include your file within a TeX document so
|
722
|
+
that the font used within the plot are exactly those of your document, you
|
723
|
+
will rather use --tex-cleanup and see what remains.
|
724
|
+
|
725
|
+
If your are a cleaning maniac and want just to have a look at your datas or a
|
726
|
+
given mathematical function, use --clean-all. Don't forget to use it together
|
727
|
+
with a viewing option, --xpdf for example.
|
728
|
+
|
729
|
+
Naming
|
730
|
+
------
|
731
|
+
|
732
|
+
If you want to keep the files but store them elsewhere, use the --save-dir
|
733
|
+
option to specify the destination directory which will be created if
|
734
|
+
necessary. That could be an option you would like to set with the CTIOGA shell
|
735
|
+
variable.
|
736
|
+
|
737
|
+
In that case (and other), you will want to differenciate the produced files
|
738
|
+
from one another by giving sensible names using -n or --name option as a
|
739
|
+
prefix for all generated files from tioga (default prefix is "Plot"). Note
|
740
|
+
that you would better avoid prefix containing extension name, you don't want
|
741
|
+
to have a plot named my_data.txt.pdf, do you ? Anyway, internal processing
|
742
|
+
will failed, especially when going through LaTeX.
|
743
|
+
|
744
|
+
Misc
|
745
|
+
----
|
746
|
+
|
747
|
+
--display-commandline display the command line you have been using to produced
|
748
|
+
the plot on the plot itself. It can be good to demonstrate simple plots but
|
749
|
+
won't be that useful if line is too long.
|
750
|
+
|
751
|
+
--mark is more efficient to remember which command has been used to produce a
|
752
|
+
plot. It fills the 'creator' field of the produced PDF file with the
|
753
|
+
command line. You can then look at it with the pdfinfo command. It is disabled
|
754
|
+
by default because the result has to be given to LaTeX which could complain.
|
755
|
+
However it does not restrain the plot to be generated so that it could be an
|
756
|
+
option to add to the CTIOGA shell variable. --no-mark option will disable it
|
757
|
+
if it is already set.
|
758
|
+
|
759
|
+
--debug and --debug-patterns are debugging tools. If you are using it, well
|
760
|
+
I'm sure your name is Vince !
|
761
|
+
|
762
|
+
I hope you enjoyed this tutorial and are now ready to make full use of the
|
763
|
+
power of Ctioga, Tioga, Ruby and Cie !
|