ctioga2 0.0 → 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog +25 -1
- data/lib/ctioga2/commands/commands.rb +13 -2
- data/lib/ctioga2/commands/doc/doc.rb +13 -17
- data/lib/ctioga2/commands/doc/documentation-commands.rb +14 -1
- data/lib/ctioga2/commands/doc/help.rb +136 -25
- data/lib/ctioga2/commands/doc/html.rb +56 -4
- data/lib/ctioga2/commands/doc/introspection.rb +45 -9
- data/lib/ctioga2/commands/doc/man.rb +7 -5
- data/lib/ctioga2/commands/doc/markup.rb +39 -12
- data/lib/ctioga2/commands/doc/wordwrap.rb +70 -0
- data/lib/ctioga2/commands/general-commands.rb +7 -4
- data/lib/ctioga2/commands/general-types.rb +27 -12
- data/lib/ctioga2/commands/interpreter.rb +2 -2
- data/lib/ctioga2/commands/parsers/command-line.rb +9 -5
- data/lib/ctioga2/commands/parsers/file.rb +5 -3
- data/lib/ctioga2/commands/type.rb +10 -3
- data/lib/ctioga2/commands/variables.rb +2 -2
- data/lib/ctioga2/data/backends/backend.rb +17 -15
- data/lib/ctioga2/data/backends/backends.rb +2 -2
- data/lib/ctioga2/data/backends/backends/gnuplot.rb +20 -5
- data/lib/ctioga2/data/backends/backends/math.rb +2 -2
- data/lib/ctioga2/data/backends/backends/text.rb +112 -17
- data/lib/ctioga2/data/backends/description.rb +10 -11
- data/lib/ctioga2/data/datacolumn.rb +73 -14
- data/lib/ctioga2/data/dataset.rb +305 -9
- data/lib/ctioga2/data/filters.rb +49 -1
- data/lib/ctioga2/data/indexed-dtable.rb +137 -0
- data/lib/ctioga2/data/point.rb +98 -7
- data/lib/ctioga2/data/stack.rb +98 -21
- data/lib/ctioga2/graphics/coordinates.rb +19 -2
- data/lib/ctioga2/graphics/elements.rb +12 -2
- data/lib/ctioga2/graphics/elements/containers.rb +14 -2
- data/lib/ctioga2/graphics/elements/contour.rb +67 -0
- data/lib/ctioga2/graphics/elements/curve2d.rb +103 -42
- data/lib/ctioga2/graphics/elements/element.rb +12 -2
- data/lib/ctioga2/graphics/elements/gradient-region.rb +94 -0
- data/lib/ctioga2/graphics/elements/parametric2d.rb +172 -0
- data/lib/ctioga2/graphics/elements/primitive.rb +37 -21
- data/lib/ctioga2/graphics/elements/region.rb +143 -0
- data/lib/ctioga2/graphics/elements/subplot.rb +92 -32
- data/lib/ctioga2/graphics/elements/tangent.rb +99 -0
- data/lib/ctioga2/graphics/elements/xyz-map.rb +126 -0
- data/lib/ctioga2/graphics/generator.rb +91 -6
- data/lib/ctioga2/graphics/legends.rb +26 -21
- data/lib/ctioga2/graphics/legends/area.rb +8 -8
- data/lib/ctioga2/graphics/legends/items.rb +5 -5
- data/lib/ctioga2/graphics/legends/storage.rb +4 -2
- data/lib/ctioga2/graphics/root.rb +24 -2
- data/lib/ctioga2/graphics/styles.rb +8 -0
- data/lib/ctioga2/graphics/styles/axes.rb +49 -23
- data/lib/ctioga2/graphics/styles/base.rb +2 -2
- data/lib/ctioga2/graphics/styles/carrays.rb +9 -2
- data/lib/ctioga2/graphics/styles/colormap.rb +272 -0
- data/lib/ctioga2/graphics/styles/curve.rb +64 -4
- data/lib/ctioga2/graphics/styles/drawable.rb +68 -9
- data/lib/ctioga2/graphics/styles/errorbar.rb +73 -0
- data/lib/ctioga2/graphics/styles/factory.rb +133 -17
- data/lib/ctioga2/graphics/styles/gradients.rb +60 -0
- data/lib/ctioga2/graphics/styles/location.rb +64 -0
- data/lib/ctioga2/graphics/styles/map-axes.rb +164 -0
- data/lib/ctioga2/graphics/styles/plot.rb +165 -62
- data/lib/ctioga2/graphics/styles/sets.rb +14 -1
- data/lib/ctioga2/graphics/styles/texts.rb +44 -34
- data/lib/ctioga2/graphics/subplot-commands.rb +94 -6
- data/lib/ctioga2/graphics/types.rb +113 -35
- data/lib/ctioga2/graphics/types/bijection.rb +3 -3
- data/lib/ctioga2/graphics/types/boundaries.rb +120 -1
- data/lib/ctioga2/graphics/types/dimensions.rb +8 -1
- data/lib/ctioga2/graphics/types/grid.rb +196 -0
- data/lib/ctioga2/graphics/types/location.rb +228 -0
- data/lib/ctioga2/graphics/types/point.rb +2 -2
- data/lib/ctioga2/log.rb +18 -18
- data/lib/ctioga2/metabuilder/type.rb +15 -3
- data/lib/ctioga2/metabuilder/types.rb +2 -2
- data/lib/ctioga2/metabuilder/types/coordinates.rb +13 -1
- data/lib/ctioga2/metabuilder/types/data.rb +50 -0
- data/lib/ctioga2/metabuilder/types/generic.rb +60 -0
- data/lib/ctioga2/metabuilder/types/lists.rb +53 -16
- data/lib/ctioga2/metabuilder/types/styles.rb +26 -45
- data/lib/ctioga2/plotmaker.rb +91 -20
- data/lib/ctioga2/postprocess.rb +8 -8
- data/lib/ctioga2/utils.rb +23 -4
- metadata +107 -75
- data/lib/ctioga2/data/merge.rb +0 -43
|
@@ -17,7 +17,7 @@ require 'ctioga2/log'
|
|
|
17
17
|
# This module contains all the classes used by ctioga
|
|
18
18
|
module CTioga2
|
|
19
19
|
|
|
20
|
-
Version::register_svn_info('$Revision:
|
|
20
|
+
Version::register_svn_info('$Revision: 161 $', '$Date: 2010-08-03 12:07:49 +0200 (Tue, 03 Aug 2010) $')
|
|
21
21
|
|
|
22
22
|
module Graphics
|
|
23
23
|
|
|
@@ -35,6 +35,11 @@ module CTioga2
|
|
|
35
35
|
[MediumSeaGreen, RoyalBlue, Pumpkin, DarkChocolate, Lilac, Crimson],
|
|
36
36
|
"colorblind" =>
|
|
37
37
|
[BrightBlue, Goldenrod, Coral, Lilac, FireBrick, RoyalPurple],
|
|
38
|
+
"gradient1" =>
|
|
39
|
+
[DarkMagenta, DarkGreen, OrangeRed, DarkRed, DarkBlue ],
|
|
40
|
+
"gradient2" =>
|
|
41
|
+
[LightPlum, PaleGreen, Gold, RedBrown, SkyBlue ],
|
|
42
|
+
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
MarkerSets = {
|
|
@@ -48,6 +53,14 @@ module CTioga2
|
|
|
48
53
|
'default' => [1.0]
|
|
49
54
|
}
|
|
50
55
|
|
|
56
|
+
XAxisSets = {
|
|
57
|
+
'default' => ['x']
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
YAxisSets = {
|
|
61
|
+
'default' => ['y']
|
|
62
|
+
}
|
|
63
|
+
|
|
51
64
|
LineStyleSets = {
|
|
52
65
|
'default' => [ LineStyles::Solid,
|
|
53
66
|
LineStyles::Dots,
|
|
@@ -17,34 +17,12 @@ require 'ctioga2/log'
|
|
|
17
17
|
# This module contains all the classes used by ctioga
|
|
18
18
|
module CTioga2
|
|
19
19
|
|
|
20
|
-
Version::register_svn_info('$Revision:
|
|
20
|
+
Version::register_svn_info('$Revision: 197 $', '$Date: 2010-11-29 14:26:12 +0100 (Mon, 29 Nov 2010) $')
|
|
21
21
|
|
|
22
22
|
module Graphics
|
|
23
23
|
|
|
24
24
|
module Styles
|
|
25
25
|
|
|
26
|
-
# Conversion between the #location attribute and the real
|
|
27
|
-
# constant used for Tioga
|
|
28
|
-
LocationToTiogaLocation = {
|
|
29
|
-
:left => Tioga::FigureConstants::LEFT,
|
|
30
|
-
:right => Tioga::FigureConstants::RIGHT,
|
|
31
|
-
:bottom => Tioga::FigureConstants::BOTTOM,
|
|
32
|
-
:top => Tioga::FigureConstants::TOP,
|
|
33
|
-
:at_x_origin => Tioga::FigureConstants::AT_X_ORIGIN,
|
|
34
|
-
:at_y_origin => Tioga::FigureConstants::AT_Y_ORIGIN
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
# Horizontal or vertical
|
|
38
|
-
LocationVertical = {
|
|
39
|
-
:left => true,
|
|
40
|
-
:right => true,
|
|
41
|
-
:bottom => false,
|
|
42
|
-
:top => false,
|
|
43
|
-
:at_x_origin => true,
|
|
44
|
-
:at_y_origin => false
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
26
|
# The style of a text object. This class is suitable for
|
|
49
27
|
# inclusion as a Hash to FigureMaker#show_axis, for the tick
|
|
50
28
|
# labels.
|
|
@@ -85,8 +63,11 @@ module CTioga2
|
|
|
85
63
|
dict['at'] = [x_or_loc, y]
|
|
86
64
|
else
|
|
87
65
|
# Perform automatic conversion on the location
|
|
88
|
-
|
|
89
|
-
|
|
66
|
+
case x_or_loc
|
|
67
|
+
when Symbol, Types::PlotLocation
|
|
68
|
+
## @todo It won't be easy to implement shifts for this,
|
|
69
|
+
## though it may be useful eventually.
|
|
70
|
+
x_or_loc = Types::PlotLocation.new(x_or_loc).tioga_location
|
|
90
71
|
end
|
|
91
72
|
dict['loc'] = x_or_loc
|
|
92
73
|
end
|
|
@@ -127,6 +108,9 @@ module CTioga2
|
|
|
127
108
|
attr_accessor :text
|
|
128
109
|
|
|
129
110
|
# The location of the label.
|
|
111
|
+
#
|
|
112
|
+
# @todo This will have to eventually use PlotLocation, as it
|
|
113
|
+
# makes much more sense.
|
|
130
114
|
attr_accessor :loc
|
|
131
115
|
|
|
132
116
|
def initialize(text = nil)
|
|
@@ -146,16 +130,12 @@ module CTioga2
|
|
|
146
130
|
# Gets the extension of the label, in units of text height.
|
|
147
131
|
# Default values for the various parameters are taken from the
|
|
148
132
|
# _default_ parameter if they are not specified.
|
|
149
|
-
def label_extension(t, default = nil,
|
|
133
|
+
def label_extension(t, default = nil, location = nil)
|
|
150
134
|
if @text
|
|
151
|
-
dict = prepare_label_dict(t, default, nil)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
extra =
|
|
155
|
-
when :top, :left
|
|
156
|
-
extra = 1
|
|
157
|
-
else # We take the safe side !
|
|
158
|
-
extra = 1
|
|
135
|
+
dict = prepare_label_dict(t, default, nil)
|
|
136
|
+
extra = 0
|
|
137
|
+
if location
|
|
138
|
+
extra = location.label_extra_space(t)
|
|
159
139
|
end
|
|
160
140
|
return (dict['shift'] + extra) * dict['scale']
|
|
161
141
|
else
|
|
@@ -270,6 +250,36 @@ module CTioga2
|
|
|
270
250
|
'font' => CmdArg.new('pdf-font')
|
|
271
251
|
}
|
|
272
252
|
|
|
253
|
+
# A LaTeX font. It should be applied to text using the function
|
|
254
|
+
# #fontify.
|
|
255
|
+
#
|
|
256
|
+
# \todo add real font attributes (family, and so on...)
|
|
257
|
+
class LaTeXFont
|
|
258
|
+
# The font command (bf, sf...). Naive but effective !
|
|
259
|
+
attr_accessor :font_command
|
|
260
|
+
|
|
261
|
+
def initialize
|
|
262
|
+
# Nothing to be done
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
def self.from_text(txt)
|
|
266
|
+
# For now, only the naive way of things:
|
|
267
|
+
font = self.new
|
|
268
|
+
font.font_command = txt
|
|
269
|
+
return font
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
# Returns text wrapping _txt_ with the appropriate functions
|
|
273
|
+
# to get the appropriate font in LaTeX.
|
|
274
|
+
def fontify(txt)
|
|
275
|
+
if @font_command
|
|
276
|
+
return "{\\#{@font_command} #{txt}}"
|
|
277
|
+
end
|
|
278
|
+
return txt
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
end
|
|
282
|
+
|
|
273
283
|
|
|
274
284
|
end
|
|
275
285
|
end
|
|
@@ -16,7 +16,7 @@ require 'ctioga2/log'
|
|
|
16
16
|
|
|
17
17
|
module CTioga2
|
|
18
18
|
|
|
19
|
-
Version::register_svn_info('$Revision:
|
|
19
|
+
Version::register_svn_info('$Revision: 214 $', '$Date: 2010-12-31 02:50:03 +0100 (Fri, 31 Dec 2010) $')
|
|
20
20
|
|
|
21
21
|
module Graphics
|
|
22
22
|
|
|
@@ -65,17 +65,17 @@ EOH
|
|
|
65
65
|
[
|
|
66
66
|
CmdArg.new('box'),
|
|
67
67
|
]) do |plotmaker, box|
|
|
68
|
+
Log::debug { "Starting a subplot with specs #{box.inspect}" }
|
|
68
69
|
subplot = plotmaker.root_object.subplot
|
|
69
70
|
subplot.subframe = box
|
|
70
71
|
end
|
|
71
72
|
|
|
72
73
|
InsetCommand.describe('Begins a new inset',
|
|
73
74
|
<<EOD, SubplotsGroup)
|
|
74
|
-
Starts a new inset
|
|
75
|
-
been issued before this one, it starts a top-level box in a blank
|
|
76
|
-
background.
|
|
75
|
+
Starts a new inset within the given box.
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
If no graph has been started yet, it just creates a new graph using
|
|
78
|
+
the given box. In short, it does what it seems it should.
|
|
79
79
|
EOD
|
|
80
80
|
|
|
81
81
|
NextInsetCommand =
|
|
@@ -91,6 +91,9 @@ EOD
|
|
|
91
91
|
NextInsetCommand.describe('Ends the previous inset and begins a new one',
|
|
92
92
|
<<EOD, SubplotsGroup)
|
|
93
93
|
Has the same effet as {command: end} followed by {command: inset}.
|
|
94
|
+
|
|
95
|
+
Particularly useful for chaining subgraphs. In that case, you might be
|
|
96
|
+
interested in the grid box specification and {command: setup-grid}.
|
|
94
97
|
EOD
|
|
95
98
|
|
|
96
99
|
EndCommand =
|
|
@@ -102,8 +105,46 @@ EOD
|
|
|
102
105
|
EndCommand.describe('Leaves the current subobject',
|
|
103
106
|
<<EOD, SubplotsGroup)
|
|
104
107
|
Leaves the current subobject.
|
|
108
|
+
EOD
|
|
109
|
+
RegionOptions = {
|
|
110
|
+
'color' => CmdArg.new('color'),
|
|
111
|
+
'transparency' => CmdArg.new('float'),
|
|
112
|
+
'reversed_color' => CmdArg.new('color'),
|
|
113
|
+
'reversed_transparency' => CmdArg.new('float'),
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
RegionCommand =
|
|
117
|
+
Cmd.new("region",nil,"--region",
|
|
118
|
+
[ ], RegionOptions) do |plotmaker, options|
|
|
119
|
+
r = plotmaker.root_object.enter_region
|
|
120
|
+
r.set_from_hash(options)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
RegionCommand.describe('Starts a region with filling between curves',
|
|
124
|
+
<<EOD, SubplotsGroup)
|
|
125
|
+
The curves up to the corresponding {command: end} will be considered for
|
|
126
|
+
delimiting a colored region between them. The actual position of the
|
|
127
|
+
curves with respect to the region can be fine-tuned using the
|
|
128
|
+
{command: region-side} command (or the corresponding option to {command: plot}).
|
|
105
129
|
EOD
|
|
106
130
|
|
|
131
|
+
GradientCommand =
|
|
132
|
+
Cmd.new("gradient",nil,"--gradient",
|
|
133
|
+
[CmdArg.new('color'), CmdArg.new('color') ], {}) do |plotmaker, s, e, options|
|
|
134
|
+
r = plotmaker.root_object.enter_gradient
|
|
135
|
+
r.start_color = s
|
|
136
|
+
r.end_color = e
|
|
137
|
+
r.set_from_hash(options)
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
GradientCommand.describe('Use a color gradient for all curves until --end',
|
|
141
|
+
<<EOD, SubplotsGroup)
|
|
142
|
+
All the curves between this command and the corresponding {command: end}
|
|
143
|
+
will have their {command: color} set to a weighted average of the
|
|
144
|
+
colors given as argument. This gives a neat gradient effect.
|
|
145
|
+
EOD
|
|
146
|
+
|
|
147
|
+
|
|
107
148
|
RescaleCommand =
|
|
108
149
|
Cmd.new("plot-scale",nil,"--plot-scale",
|
|
109
150
|
[CmdArg.new('float')],
|
|
@@ -118,7 +159,7 @@ EOD
|
|
|
118
159
|
Styles::PlotStyle.current_plot_style(plotmaker).text_scale = scale
|
|
119
160
|
Styles::PlotStyle.current_plot_style(plotmaker).lines_scale = scale
|
|
120
161
|
else
|
|
121
|
-
CTioga2::Log::error "Unkown 'what' option for plot-scale: #{what}"
|
|
162
|
+
CTioga2::Log::error { "Unkown 'what' option for plot-scale: #{what}" }
|
|
122
163
|
end
|
|
123
164
|
end
|
|
124
165
|
|
|
@@ -133,6 +174,53 @@ Scaling also applies to all elements of the plot that were added
|
|
|
133
174
|
before the call to plot-scale.
|
|
134
175
|
EOD
|
|
135
176
|
|
|
177
|
+
# Options for the SetupGrid command:
|
|
178
|
+
SetupGridOptions = {}
|
|
179
|
+
for n in %w(left right top bottom dx dy)
|
|
180
|
+
SetupGridOptions[n] = CmdArg.new('dimension')
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
SetupGridCommand =
|
|
184
|
+
Cmd.new('setup-grid', nil, '--setup-grid',
|
|
185
|
+
[ CmdArg.new('text') ], SetupGridOptions
|
|
186
|
+
) do |plotmaker, nup, options|
|
|
187
|
+
grd = Types::GridLayout.new(nup)
|
|
188
|
+
for f in %w(left right top bottom)
|
|
189
|
+
if options.key? f
|
|
190
|
+
grd.outer_margins[f] = options[f]
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
grd.delta_x = options['dx'] if options['dx']
|
|
194
|
+
grd.delta_y = options['dy'] if options['dy']
|
|
195
|
+
Types::GridLayout.current_grid = grd
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
SetupGridCommand.describe("Setup grid for insets",
|
|
199
|
+
<<"EOH", SubplotsGroup)
|
|
200
|
+
Sets up a grid of the given layout (such as 2x1). After this command,
|
|
201
|
+
arguments such as grid:0,1 can be used as the {type: box} argument of
|
|
202
|
+
{command: inset} and {command: next-inset} commands.
|
|
203
|
+
|
|
204
|
+
Alternatively, the layout can be specified as 1,2,1x1,4, in which case
|
|
205
|
+
there are three columns and two rows; the second column is 2 times
|
|
206
|
+
larger than the other ones, while the second row is four times larger
|
|
207
|
+
than the first.
|
|
208
|
+
EOH
|
|
209
|
+
|
|
210
|
+
ZoomCommand =
|
|
211
|
+
Cmd.new("zoom-inset",nil,"--zoom-inset",
|
|
212
|
+
[
|
|
213
|
+
CmdArg.new('box'),
|
|
214
|
+
]) do |plotmaker, box|
|
|
215
|
+
subplot = plotmaker.root_object.subplot
|
|
216
|
+
subplot.subframe = box
|
|
217
|
+
raise YetUnimplemented.new("zooms are not yet implemented !")
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
ZoomCommand.describe('Starts an inset ',
|
|
221
|
+
<<EOD, SubplotsGroup)
|
|
222
|
+
Zooms are currently not implemented yet.
|
|
223
|
+
EOD
|
|
136
224
|
|
|
137
225
|
|
|
138
226
|
end
|
|
@@ -16,12 +16,16 @@ require 'ctioga2/graphics/types/point'
|
|
|
16
16
|
require 'ctioga2/graphics/types/boundaries'
|
|
17
17
|
require 'ctioga2/graphics/types/boxes'
|
|
18
18
|
require 'ctioga2/graphics/types/bijection'
|
|
19
|
+
require 'ctioga2/graphics/types/location'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
require 'ctioga2/graphics/types/grid'
|
|
19
23
|
|
|
20
24
|
# In addition to the former, here are some useful constants
|
|
21
25
|
# This module contains all the classes used by ctioga
|
|
22
26
|
module CTioga2
|
|
23
27
|
|
|
24
|
-
Version::register_svn_info('$Revision:
|
|
28
|
+
Version::register_svn_info('$Revision: 249 $', '$Date: 2011-01-29 14:05:04 +0100 (Sat, 29 Jan 2011) $')
|
|
25
29
|
|
|
26
30
|
module Graphics
|
|
27
31
|
|
|
@@ -47,11 +51,11 @@ module CTioga2
|
|
|
47
51
|
:namespace => Tioga::ColorConstants
|
|
48
52
|
}, <<EOD)
|
|
49
53
|
A color. It can take three forms:
|
|
50
|
-
*
|
|
51
|
-
http://tioga.rubyforge.org/doc/classes/Tioga/ColorConstants.html
|
|
52
|
-
for the list of
|
|
53
|
-
* an HTML color: for instance,
|
|
54
|
-
* a list of three numbers between 0 and 1: 1,0,0 is red too.
|
|
54
|
+
* a named color, see
|
|
55
|
+
{url: http://tioga.rubyforge.org/doc/classes/Tioga/ColorConstants.html}
|
|
56
|
+
for the list of color names.
|
|
57
|
+
* an HTML color: for instance, @#f00@ or @#ff0000@ is red;
|
|
58
|
+
* a list of three numbers between 0 and 1: @1,0,0@ is red too.
|
|
55
59
|
EOD
|
|
56
60
|
|
|
57
61
|
ColorOrFalseType =
|
|
@@ -63,12 +67,51 @@ EOD
|
|
|
63
67
|
A {type: color}, or false to say that nothing should be drawn.
|
|
64
68
|
EOD
|
|
65
69
|
|
|
70
|
+
CurveFillUntilType = CmdType.new('fill-until', {
|
|
71
|
+
:type => :float,
|
|
72
|
+
:shortcuts => {
|
|
73
|
+
/x?axis/i => 0.0,
|
|
74
|
+
/b(?:ot(?:tom)?)?/i => :bottom,
|
|
75
|
+
/t(?:op)?/i => :top,
|
|
76
|
+
/no(?:ne)?/i => false
|
|
77
|
+
}
|
|
78
|
+
}, <<EOD)
|
|
79
|
+
The Y values until which a filled curve will be filled. Generally a number,
|
|
80
|
+
but it can also be:
|
|
81
|
+
* @axis@ (or @xaxis@), which means 0
|
|
82
|
+
* @bottom@, to fill until the bottom of the graph
|
|
83
|
+
* @top@, to fill until the top
|
|
84
|
+
* @none@, meaning no fill
|
|
85
|
+
EOD
|
|
86
|
+
|
|
87
|
+
RegionSideType =
|
|
88
|
+
CmdType.new('region-side', {
|
|
89
|
+
:type => :list,
|
|
90
|
+
:list => {},
|
|
91
|
+
:shortcuts => {
|
|
92
|
+
'above' => :above,
|
|
93
|
+
'below' => :below,
|
|
94
|
+
'ignore' => false,
|
|
95
|
+
}
|
|
96
|
+
}, <<EOD)
|
|
97
|
+
Within a {command: region}, designates the position of the curve with
|
|
98
|
+
respect to the region:
|
|
99
|
+
* @above@
|
|
100
|
+
* @below@
|
|
101
|
+
* @ignore@ if this curve is not to be taken into account
|
|
102
|
+
EOD
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
66
106
|
LineStyleType =
|
|
67
107
|
CmdType.new('line-style', {
|
|
68
108
|
:type => :tioga_line_style,
|
|
69
|
-
:namespace => LineStyles
|
|
109
|
+
:namespace => LineStyles,
|
|
110
|
+
:shortcuts => {
|
|
111
|
+
/no(ne)?|off/i => false,
|
|
112
|
+
}
|
|
70
113
|
}, <<EOD)
|
|
71
|
-
A line style.
|
|
114
|
+
A line style, or @no@, @none@ or @off@ to mean no line.
|
|
72
115
|
EOD
|
|
73
116
|
|
|
74
117
|
MarkerType =
|
|
@@ -89,20 +132,53 @@ EOD
|
|
|
89
132
|
A given point on a figure.
|
|
90
133
|
EOD
|
|
91
134
|
|
|
135
|
+
# We need a very specific type for that as we want to have a reference
|
|
136
|
+
# to the level too !
|
|
137
|
+
LevelType =
|
|
138
|
+
CmdType.new('level', :level, <<EOD)
|
|
139
|
+
A level on a XYZ map (that is, just a Z value).
|
|
140
|
+
EOD
|
|
141
|
+
|
|
142
|
+
JustificationRE = {
|
|
143
|
+
/l(eft)?/i => Tioga::FigureConstants::LEFT_JUSTIFIED,
|
|
144
|
+
/c(enter)?/i => Tioga::FigureConstants::CENTERED,
|
|
145
|
+
/r(ight)?/i => Tioga::FigureConstants::RIGHT_JUSTIFIED
|
|
146
|
+
}
|
|
147
|
+
|
|
92
148
|
JustificationType =
|
|
93
|
-
CmdType.new('justification', :
|
|
94
|
-
|
|
149
|
+
CmdType.new('justification', {:type => :re_list,
|
|
150
|
+
:list => JustificationRE}, <<EOD)
|
|
151
|
+
Horizontal aligment for text. Can be one of:
|
|
152
|
+
* @l@ or @left@
|
|
153
|
+
* @c@, @center@
|
|
154
|
+
* @r@, @right@
|
|
95
155
|
EOD
|
|
96
156
|
|
|
157
|
+
# Regular expression for vertical alignment
|
|
158
|
+
AlignmentRE = {
|
|
159
|
+
/t(op)?/i => Tioga::FigureConstants::ALIGNED_AT_TOP,
|
|
160
|
+
/c(enter)|m(idheight)/i => Tioga::FigureConstants::ALIGNED_AT_MIDHEIGHT,
|
|
161
|
+
/B|Baseline|baseline/ => Tioga::FigureConstants::ALIGNED_AT_BASELINE,
|
|
162
|
+
/b(ottom)?/ => Tioga::FigureConstants::ALIGNED_AT_BOTTOM
|
|
163
|
+
}
|
|
164
|
+
|
|
97
165
|
AlignmentType =
|
|
98
|
-
|
|
99
|
-
|
|
166
|
+
CmdType.new('alignment', {:type => :re_list,
|
|
167
|
+
:list => AlignmentRE},
|
|
168
|
+
<<EOD)
|
|
169
|
+
Vertical aligment for text. Can be one of:
|
|
170
|
+
* @t@ or @top@
|
|
171
|
+
* @c@, @center@, @m@ or @midheight@ (vertically centered)
|
|
172
|
+
* @B@, @Baseline@ or @baseline@ to align at the baseline
|
|
173
|
+
* @b@ or @bottom@
|
|
100
174
|
EOD
|
|
101
175
|
|
|
102
176
|
PDFFont =
|
|
103
177
|
CmdType.new('pdf-font', :integer, <<EOD)
|
|
104
178
|
A number between 1 and 14 that designates one of the 14 standard
|
|
105
|
-
PDF fonts.
|
|
179
|
+
PDF fonts. (see for instance
|
|
180
|
+
{url: http://tioga.rubyforge.org/doc/classes/Tioga/MarkerConstants.html}
|
|
181
|
+
for more information).
|
|
106
182
|
EOD
|
|
107
183
|
|
|
108
184
|
AlignedPointType =
|
|
@@ -118,14 +194,13 @@ EOD
|
|
|
118
194
|
Margins around a plot, ie the distance from the side of the plot to
|
|
119
195
|
the corresponding side of the container (most likely the whole
|
|
120
196
|
PDF). It can take three forms:
|
|
197
|
+
* @dimension@ (applies to all sides)
|
|
198
|
+
* @left_right, top_bottom@
|
|
199
|
+
* @left, right, top, bottom@
|
|
121
200
|
|
|
122
|
-
|
|
123
|
-
* left_right, top_bottom
|
|
124
|
-
* left, right, top, bottom
|
|
201
|
+
Each of these elements is a valid {type: dimension}.
|
|
125
202
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
It can also be auto, in which case the position of the margins is
|
|
203
|
+
It can also be @auto@, in which case the position of the margins is
|
|
129
204
|
computed automatically to accomodate the various labels/ticks.
|
|
130
205
|
EOD
|
|
131
206
|
|
|
@@ -134,7 +209,13 @@ EOD
|
|
|
134
209
|
AxisDecorationType =
|
|
135
210
|
CmdType.new('axis-decoration', :tioga_axis_type, <<EOD)
|
|
136
211
|
Kinds of decoration on a axis line, such as nothing, lines, ticks,
|
|
137
|
-
tick labels
|
|
212
|
+
tick labels. Possible values:
|
|
213
|
+
* @hidden@ or @off@: no axis at all
|
|
214
|
+
* @line@: only a line
|
|
215
|
+
* @ticks@: only ticks
|
|
216
|
+
* @major@: only major ticks
|
|
217
|
+
* @major-num@: major ticks along with their labels
|
|
218
|
+
* @full@: major ticks and labels + minor ticks
|
|
138
219
|
EOD
|
|
139
220
|
|
|
140
221
|
# Dimensions
|
|
@@ -145,16 +226,13 @@ EOD
|
|
|
145
226
|
|
|
146
227
|
A dimension, in absolute units, or in units of text height, figure,
|
|
147
228
|
frame or page coordinates. It is in the form
|
|
148
|
-
|
|
149
|
-
@
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
page (1.0 page is the whole height/width of the output file).
|
|
156
|
-
|
|
157
|
-
figure can be abbreviated as f, frame as F and page as p.
|
|
229
|
+
@value unit@
|
|
230
|
+
where @value@ is a number and unit can be one of @pt@,
|
|
231
|
+
@bp@, @in@, @cm@ (absolute units, same meaning as in TeX),
|
|
232
|
+
@dy@ (@1.0 dy@ is the height of a text
|
|
233
|
+
line), @figure@ or @f@ (for figure coordinates, i.e. the coordinates of the
|
|
234
|
+
plot), @frame@ or @F@ (@1.0 frame@ is the full size of the current subplot) and
|
|
235
|
+
@page@ or @p@ (@1.0 page@ is the whole height/width of the output file).
|
|
158
236
|
EOD
|
|
159
237
|
|
|
160
238
|
# Boxes
|
|
@@ -164,20 +242,20 @@ EOD
|
|
|
164
242
|
The specification for a box, such as an inset. Specifications vary for
|
|
165
243
|
now...
|
|
166
244
|
|
|
167
|
-
|
|
245
|
+
@todo to be written later on.
|
|
168
246
|
EOD
|
|
169
247
|
|
|
170
248
|
# Coordinate transformations
|
|
171
249
|
BijectionType =
|
|
172
250
|
CmdType.new('bijection', :bijection, <<EOD)
|
|
173
251
|
A pair of functions of x specifying a bidirectional coordinate
|
|
174
|
-
transformation
|
|
175
|
-
from::to
|
|
252
|
+
transformation separated by a double colon (@::@), in the order
|
|
253
|
+
@from::to@.
|
|
176
254
|
|
|
177
255
|
Each of the functions must be valid Ruby code - it is not exactly
|
|
178
256
|
mathematical functions, in particular Ruby does not like floats which
|
|
179
|
-
are missing digits on either side of the dot : for instance,
|
|
180
|
-
1
|
|
257
|
+
are missing digits on either side of the dot : for instance, @.3@ and
|
|
258
|
+
@1.@ are not valid. Sorry.
|
|
181
259
|
|
|
182
260
|
In most of the usual cases, the coordinate transform is an involution,
|
|
183
261
|
that is from and to is the same function (this is the case for
|