ctioga2 0.0 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/Changelog +25 -1
  2. data/lib/ctioga2/commands/commands.rb +13 -2
  3. data/lib/ctioga2/commands/doc/doc.rb +13 -17
  4. data/lib/ctioga2/commands/doc/documentation-commands.rb +14 -1
  5. data/lib/ctioga2/commands/doc/help.rb +136 -25
  6. data/lib/ctioga2/commands/doc/html.rb +56 -4
  7. data/lib/ctioga2/commands/doc/introspection.rb +45 -9
  8. data/lib/ctioga2/commands/doc/man.rb +7 -5
  9. data/lib/ctioga2/commands/doc/markup.rb +39 -12
  10. data/lib/ctioga2/commands/doc/wordwrap.rb +70 -0
  11. data/lib/ctioga2/commands/general-commands.rb +7 -4
  12. data/lib/ctioga2/commands/general-types.rb +27 -12
  13. data/lib/ctioga2/commands/interpreter.rb +2 -2
  14. data/lib/ctioga2/commands/parsers/command-line.rb +9 -5
  15. data/lib/ctioga2/commands/parsers/file.rb +5 -3
  16. data/lib/ctioga2/commands/type.rb +10 -3
  17. data/lib/ctioga2/commands/variables.rb +2 -2
  18. data/lib/ctioga2/data/backends/backend.rb +17 -15
  19. data/lib/ctioga2/data/backends/backends.rb +2 -2
  20. data/lib/ctioga2/data/backends/backends/gnuplot.rb +20 -5
  21. data/lib/ctioga2/data/backends/backends/math.rb +2 -2
  22. data/lib/ctioga2/data/backends/backends/text.rb +112 -17
  23. data/lib/ctioga2/data/backends/description.rb +10 -11
  24. data/lib/ctioga2/data/datacolumn.rb +73 -14
  25. data/lib/ctioga2/data/dataset.rb +305 -9
  26. data/lib/ctioga2/data/filters.rb +49 -1
  27. data/lib/ctioga2/data/indexed-dtable.rb +137 -0
  28. data/lib/ctioga2/data/point.rb +98 -7
  29. data/lib/ctioga2/data/stack.rb +98 -21
  30. data/lib/ctioga2/graphics/coordinates.rb +19 -2
  31. data/lib/ctioga2/graphics/elements.rb +12 -2
  32. data/lib/ctioga2/graphics/elements/containers.rb +14 -2
  33. data/lib/ctioga2/graphics/elements/contour.rb +67 -0
  34. data/lib/ctioga2/graphics/elements/curve2d.rb +103 -42
  35. data/lib/ctioga2/graphics/elements/element.rb +12 -2
  36. data/lib/ctioga2/graphics/elements/gradient-region.rb +94 -0
  37. data/lib/ctioga2/graphics/elements/parametric2d.rb +172 -0
  38. data/lib/ctioga2/graphics/elements/primitive.rb +37 -21
  39. data/lib/ctioga2/graphics/elements/region.rb +143 -0
  40. data/lib/ctioga2/graphics/elements/subplot.rb +92 -32
  41. data/lib/ctioga2/graphics/elements/tangent.rb +99 -0
  42. data/lib/ctioga2/graphics/elements/xyz-map.rb +126 -0
  43. data/lib/ctioga2/graphics/generator.rb +91 -6
  44. data/lib/ctioga2/graphics/legends.rb +26 -21
  45. data/lib/ctioga2/graphics/legends/area.rb +8 -8
  46. data/lib/ctioga2/graphics/legends/items.rb +5 -5
  47. data/lib/ctioga2/graphics/legends/storage.rb +4 -2
  48. data/lib/ctioga2/graphics/root.rb +24 -2
  49. data/lib/ctioga2/graphics/styles.rb +8 -0
  50. data/lib/ctioga2/graphics/styles/axes.rb +49 -23
  51. data/lib/ctioga2/graphics/styles/base.rb +2 -2
  52. data/lib/ctioga2/graphics/styles/carrays.rb +9 -2
  53. data/lib/ctioga2/graphics/styles/colormap.rb +272 -0
  54. data/lib/ctioga2/graphics/styles/curve.rb +64 -4
  55. data/lib/ctioga2/graphics/styles/drawable.rb +68 -9
  56. data/lib/ctioga2/graphics/styles/errorbar.rb +73 -0
  57. data/lib/ctioga2/graphics/styles/factory.rb +133 -17
  58. data/lib/ctioga2/graphics/styles/gradients.rb +60 -0
  59. data/lib/ctioga2/graphics/styles/location.rb +64 -0
  60. data/lib/ctioga2/graphics/styles/map-axes.rb +164 -0
  61. data/lib/ctioga2/graphics/styles/plot.rb +165 -62
  62. data/lib/ctioga2/graphics/styles/sets.rb +14 -1
  63. data/lib/ctioga2/graphics/styles/texts.rb +44 -34
  64. data/lib/ctioga2/graphics/subplot-commands.rb +94 -6
  65. data/lib/ctioga2/graphics/types.rb +113 -35
  66. data/lib/ctioga2/graphics/types/bijection.rb +3 -3
  67. data/lib/ctioga2/graphics/types/boundaries.rb +120 -1
  68. data/lib/ctioga2/graphics/types/dimensions.rb +8 -1
  69. data/lib/ctioga2/graphics/types/grid.rb +196 -0
  70. data/lib/ctioga2/graphics/types/location.rb +228 -0
  71. data/lib/ctioga2/graphics/types/point.rb +2 -2
  72. data/lib/ctioga2/log.rb +18 -18
  73. data/lib/ctioga2/metabuilder/type.rb +15 -3
  74. data/lib/ctioga2/metabuilder/types.rb +2 -2
  75. data/lib/ctioga2/metabuilder/types/coordinates.rb +13 -1
  76. data/lib/ctioga2/metabuilder/types/data.rb +50 -0
  77. data/lib/ctioga2/metabuilder/types/generic.rb +60 -0
  78. data/lib/ctioga2/metabuilder/types/lists.rb +53 -16
  79. data/lib/ctioga2/metabuilder/types/styles.rb +26 -45
  80. data/lib/ctioga2/plotmaker.rb +91 -20
  81. data/lib/ctioga2/postprocess.rb +8 -8
  82. data/lib/ctioga2/utils.rb +23 -4
  83. metadata +107 -75
  84. data/lib/ctioga2/data/merge.rb +0 -43
@@ -0,0 +1,164 @@
1
+ # axes.rb: the style of one axis or edge
2
+ # copyright (c) 2009 by Vincent Fourmond
3
+
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2 of the License, or
7
+ # (at your option) any later version.
8
+
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details (in the COPYING file).
13
+
14
+ require 'ctioga2/utils'
15
+ require 'ctioga2/log'
16
+
17
+ # This module contains all the classes used by ctioga
18
+ module CTioga2
19
+
20
+ Version::register_svn_info('$Revision$', '$Date$')
21
+
22
+ module Graphics
23
+
24
+ module Styles
25
+
26
+
27
+ # This class handles the display of a Z axis color map, in the
28
+ # form of a colored bar with ticks and a label.
29
+ class MapAxisStyle < AxisStyle
30
+
31
+ # The actual color map
32
+ attr_accessor :color_map
33
+
34
+ # Zmin and Zmax boundaries
35
+ attr_accessor :bounds
36
+
37
+ # Size of the bar (not counting the label)
38
+ attr_accessor :bar_size
39
+
40
+ # Space to be left between the graph and the beginning of the
41
+ # graph
42
+ attr_accessor :bar_shift
43
+
44
+ # Space to be left on the side
45
+ attr_accessor :padding
46
+
47
+ # Creates a new MapAxisStyle object at the given location with
48
+ # the given style.
49
+ def initialize()
50
+ super()
51
+
52
+ @bar_size = Types::Dimension.new(:dy, 2, :x)
53
+
54
+ # Shifting away from the location.
55
+ @bar_shift = Types::Dimension.new(:dy, 0.3, :x)
56
+
57
+ ## @todo maybe use different padding for left and right ?
58
+ @padding = Types::Dimension.new(:dy, 0.5, :x)
59
+
60
+ @decoration = AXIS_WITH_TICKS_AND_NUMERIC_LABELS
61
+
62
+ # To be implemented one day...
63
+ @other_side_decoration = nil
64
+ end
65
+
66
+ def set_color_map(color_map, zmin, zmax)
67
+ @bounds = [zmin, zmax]
68
+ @color_map = color_map
69
+
70
+ end
71
+
72
+ def draw_axis(t)
73
+ # Not beautiful at all
74
+ size = Types::Dimension.new(:dy, extension(t),
75
+ @location.orientation)
76
+ label_size =
77
+ Types::Dimension.new(:dy, labels_only_extension(t, style = nil),
78
+ @location.orientation)
79
+
80
+ @location.do_sub_frame(t, size) do
81
+ # This is a necessary workaround for a small bug
82
+ t.set_subframe([0,0,0,0])
83
+ # Here, do the correct setup, using a MarginsBox:
84
+ # * correctly setup the axes/edges
85
+ # * handle the sides correctly.
86
+ # * position the subplot within accordingly
87
+ # * use draw_axis for the axis ?
88
+
89
+ plot_box = Types::MarginsBox.
90
+ new(*@location.reorient_margins(@bar_shift, label_size,
91
+ @padding, @padding))
92
+
93
+ # We wrap the call within a subplot
94
+ t.subplot(plot_box.to_frame_margins(t)) do
95
+ bounds = if @location.vertical?
96
+ [0, 1, @bounds.last, @bounds.first]
97
+ else
98
+ [@bounds.first, @bounds.last, 0, 1]
99
+ end
100
+ t.set_bounds(bounds)
101
+ t.context do
102
+ t.clip_to_frame
103
+ cmap, zmin, zmax = *@color_map.to_colormap(t, @bounds.first,
104
+ @bounds.last)
105
+
106
+ sp = [0.5, zmin]
107
+ ep = [0.5, zmax]
108
+ if ! @location.vertical?
109
+ sp.reverse!
110
+ ep.reverse!
111
+ end
112
+ t.axial_shading(
113
+ 'start_point' => sp,
114
+ 'end_point' => ep,
115
+ 'colormap' => cmap
116
+ )
117
+ end
118
+ ## @todo handle axis color ?
119
+ t.stroke_frame
120
+ ## @todo potentially handle decorations for the other
121
+ ## side too.
122
+
123
+ ## @todo This is a ugly hack, but Ruby doesn't allow a
124
+ ## clean one. Though
125
+ ## http://stackoverflow.com/questions/1251178/calling-another-method-in-super-class-in-ruby
126
+ ## seems like the way to go ! To be implemented one day.
127
+ self.class.superclass.instance_method(:draw_axis).
128
+ bind(self).call(t)
129
+
130
+ end
131
+
132
+ end
133
+ end
134
+
135
+ def set_bounds_for_axis(t, range = nil)
136
+ # Useless here
137
+ end
138
+
139
+ # Draw the axis background lines:
140
+ def draw_background_lines(t)
141
+ # Nothing to do
142
+ end
143
+
144
+ def extension(t, style = nil)
145
+ base = super(t, style)
146
+
147
+ base += @bar_size.to_text_height(t, @location.orientation)
148
+ base += @bar_shift.to_text_height(t, @location.orientation)
149
+ return base
150
+ end
151
+
152
+ # Whether the axis is vertical or not
153
+ def vertical?
154
+ return @location.vertical?
155
+ end
156
+
157
+ end
158
+
159
+ ZAxisStyle = FullAxisStyle.dup
160
+ ZAxisStyle['bar_size'] = CmdArg.new('dimension')
161
+ ZAxisStyle['bar_shift'] = CmdArg.new('dimension')
162
+ end
163
+ end
164
+ end
@@ -19,7 +19,7 @@ require 'ctioga2/graphics/coordinates'
19
19
  # This module contains all the classes used by ctioga
20
20
  module CTioga2
21
21
 
22
- Version::register_svn_info('$Revision: 94 $', '$Date: 2009-06-25 23:37:13 +0200 (Thu, 25 Jun 2009) $')
22
+ Version::register_svn_info('$Revision: 202 $', '$Date: 2010-11-30 22:21:17 +0100 (Tue, 30 Nov 2010) $')
23
23
 
24
24
  module Graphics
25
25
 
@@ -27,7 +27,7 @@ module CTioga2
27
27
 
28
28
  # The style of a Elements::Subplot object.
29
29
  #
30
- # TODO: it should hold
30
+ # \todo it should hold
31
31
  # * labels
32
32
  # * axes and edges (in a *clean* way !)
33
33
  # * ticks
@@ -37,6 +37,8 @@ module CTioga2
37
37
 
38
38
  include Tioga::FigureConstants
39
39
 
40
+ include Log
41
+
40
42
  # The various sides of the plot. A hash location -> AxisStyle.
41
43
  attr_accessor :axes
42
44
 
@@ -87,7 +89,7 @@ module CTioga2
87
89
  @yaxis_location = :left
88
90
 
89
91
  @title = TextLabel.new
90
- @title.loc = :top
92
+ @title.loc = Types::PlotLocation.new(:top)
91
93
 
92
94
  @plot_margin = nil
93
95
 
@@ -103,6 +105,9 @@ module CTioga2
103
105
  #
104
106
  # Now the question is: how should that affect user-defined
105
107
  # axes ? It should not.
108
+ #
109
+ # \todo This really should move to Axis when transformations
110
+ # are handled correctly.
106
111
  def set_log_scale(which, val)
107
112
  case which
108
113
  when :x
@@ -118,26 +123,55 @@ module CTioga2
118
123
  end
119
124
  end
120
125
 
126
+ # Sets the axis which should be used for subsequent objects
127
+ # (for which no axis is specified) for the given plot
128
+ def set_default_axis(which, name)
129
+ axis = get_axis_key(name)
130
+ self.send("#{which}axis_location=", axis)
131
+ end
132
+
133
+
121
134
  # Returns the AxisStyle corresponding to the named
122
135
  # axis. _name_ can be:
123
- # * one of the named elements of axes (ie, by default: top,
124
- # left, right, bottom). All names are stripped from spaces
125
- # around, and downcased (see #clean_axis_name).
136
+ #
137
+ # * one of the named axes (ie, by default: top, left, right,
138
+ # bottom). All names are stripped from spaces around, and
139
+ # downcased (see #clean_axis_name). Can be also user-defined
140
+ # axes.
141
+ #
126
142
  # * x(axis)?/y(axis)?, which returns the default object for the
127
143
  # given location
144
+ #
145
+ # \todo Maybe x2 and y2 could be provided to signify "the side
146
+ # which isn't the default" ?
128
147
  def get_axis_style(name)
148
+ style = @axes[get_axis_key(name)]
149
+ if ! style
150
+ ## @todo Type-safe exception here
151
+ raise "Unkown named axis: '#{name}'"
152
+ else
153
+ return style
154
+ end
155
+ end
156
+
157
+ # Returns the key corresponding to the named axis. See
158
+ # #get_axis_style for more information; though ultimately the
159
+ # latter is using this function.
160
+ def get_axis_key(name)
129
161
  if name =~ /^\s*([xy])(?:axis)?\s*$/i
130
- return @axes[self.send("#{$1.downcase}axis_location")]
162
+ return self.send("#{$1.downcase}axis_location")
131
163
  else
132
- style = @axes[clean_axis_name(name)]
133
- if ! style
134
- raise "Unkown named axis: '#{name}'"
135
- else
136
- return style
137
- end
138
- end
164
+ return clean_axis_name(name)
165
+ end
166
+ end
167
+
168
+ def set_axis_style(name, style)
169
+ key = get_axis_key(name)
170
+ @axes[key] = style
139
171
  end
140
172
 
173
+
174
+
141
175
  # Returns a BaseTextStyle or similar for the given
142
176
  # location. The location is of the form:
143
177
  # axis_name(_(ticks?|label))
@@ -166,16 +200,27 @@ module CTioga2
166
200
  style = get_label_style(which)
167
201
  hash = hash.merge({'text' => text}) unless text.nil?
168
202
  if hash.key?('text') and ! style.is_a?(TextLabel)
169
- CTioga2::Log::warn("Text property of label #{which} was set, but this has no meaning: tick labels can't be set this way. Did you mean to use \"#{which}_label\"" + " instead ?")
203
+ CTioga2::Log::warn {"Text property of label #{which} was set, but this has no meaning: tick labels can't be set this way. Did you mean to use \"#{which}_label\"" + " instead ?" }
170
204
  end
171
205
  style.set_from_hash(hash)
172
206
  end
173
207
 
174
208
 
175
- # Draws all axes for the plot.
176
- def draw_all_axes(t)
209
+ # Draws all axes for the plot. The _bounds_ argument is that
210
+ # computed by Subplot#compute_boundaries; it is there to
211
+ # ensure that the axes know whether they have their own
212
+ # coordinate system or if they just follow what's around.
213
+ def draw_all_axes(t, bounds)
177
214
  for which, axis in @axes
178
- axis.draw_axis(t)
215
+ t.context do
216
+ begin
217
+ axis.set_bounds_for_axis(t, bounds[which])
218
+ axis.draw_axis(t)
219
+ rescue Exception => e
220
+ error { "Impossible to draw axis #{which}: #{e.message}" }
221
+ debug { "Full message: #{e.inspect}" }
222
+ end
223
+ end
179
224
  end
180
225
  # We draw the title last
181
226
  title.draw(t, 'title')
@@ -218,18 +263,16 @@ module CTioga2
218
263
  # Returns a Types::MarginsBox
219
264
  def estimate_margins(t)
220
265
  margins = [:left, :right, :top, :bottom].map do |side|
221
- ext = @axes[side].extension(t,self)
222
- if side == @title.loc
223
- ext2 = @title.label_extension(t, 'title', side) *
266
+ exts = axes_for_side(side).map do |ax|
267
+ ax.extension(t,self)
268
+ end
269
+ if @title.loc.is_side?(side)
270
+ exts << @title.label_extension(t, 'title', @title.loc) *
224
271
  (@text_scale || 1)
225
- if ext < ext2
226
- ext = ext2
227
- end
228
272
  end
229
- Types::Dimension.new(:dy, ext)
273
+ Types::Dimension.new(:dy, exts.max)
230
274
  end
231
275
 
232
- # TODO: add the plot title !
233
276
  box = Types::MarginsBox.new(*margins)
234
277
  if @padding
235
278
  for dim in box.margins
@@ -251,6 +294,16 @@ module CTioga2
251
294
  return $1.downcase.to_sym
252
295
  end
253
296
 
297
+ # Returns the list of AxisStyle corresponding to the given
298
+ # side (:top, :eft, etc...)
299
+ def axes_for_side(side)
300
+ ret = []
301
+ for k,v in @axes
302
+ ret << v if v.location.is_side?(side)
303
+ end
304
+ return ret
305
+ end
306
+
254
307
  end
255
308
 
256
309
  AxisGroup = CmdGroup.new('axes-labels',
@@ -293,7 +346,7 @@ given axis, through its various options:
293
346
  * decoration
294
347
  EOH
295
348
 
296
- BackgroundLinesCommands =
349
+ BackgroundLinesCommand =
297
350
  Cmd.new('background-lines', nil, '--background-lines',
298
351
  [
299
352
  CmdArg.new('axis'),
@@ -316,72 +369,122 @@ EOH
316
369
  end
317
370
  end
318
371
 
319
- BackgroundLinesCommands.
372
+ BackgroundLinesCommand.
320
373
  describe("Sets the color of the background lines",
321
374
  <<"EOH", AxisGroup)
322
375
  Sets the color of the background lines for the given axis.
323
376
  EOH
324
377
 
325
378
 
326
- XAxisLabelCommand =
327
- Cmd.new('xlabel', '-x', '--xlabel', [ CmdArg.new('text') ],
379
+ %w{x y}.each do |axis|
380
+ labelcmd = Cmd.new("#{axis}label", "-#{axis}",
381
+ "--#{axis}label", [ CmdArg.new('text') ],
382
+ FullTextStyleOptions) do |plotmaker, label, options|
383
+ PlotStyle.current_plot_style(plotmaker).
384
+ set_label_style("#{axis}_label", options, label)
385
+ end
386
+ labelcmd.describe("Sets the #{axis.upcase} label of the plot",
387
+ <<"EOH", AxisGroup)
388
+ Sets the #{axis.upcase} label of the current plot.
389
+ EOH
390
+
391
+ nolabelcmd = Cmd.new("no-#{axis}label", nil,
392
+ "--no-#{axis}label", []) do |plotmaker|
393
+ PlotStyle.current_plot_style(plotmaker).
394
+ set_label_style("#{axis}_label", {}, false)
395
+ end
396
+ nolabelcmd.describe("Disables #{axis.upcase} label for the plot",
397
+ <<"EOH", AxisGroup)
398
+ Removes the #{axis.upcase} label for the current plot.
399
+ EOH
400
+
401
+ daxiscmd = Cmd.new("#{axis}axis", nil,
402
+ "--#{axis}axis", [ CmdArg.new('axis') ],
403
+ {}) do |plotmaker, ax|
404
+ PlotStyle.current_plot_style(plotmaker).
405
+ set_default_axis(axis, ax)
406
+ end
407
+ daxiscmd.describe("Sets default #{axis.upcase} axis for the plot",
408
+ <<"EOD", AxisGroup)
409
+ Sets the default axis for the #{axis.upcase} axis for all subsequent
410
+ commands take rely on default axes (such as {command: plot},
411
+ {command: xrange}, {command: yrange}...).
412
+ EOD
413
+
414
+
415
+ end
416
+
417
+ TitleLabelCommand =
418
+ Cmd.new('title', '-t', '--title', [ CmdArg.new('text') ],
328
419
  FullTextStyleOptions) do |plotmaker, label, options|
329
420
  PlotStyle.current_plot_style(plotmaker).
330
- set_label_style('x_label', options, label)
421
+ set_label_style('title', options, label)
331
422
  end
332
423
 
333
- XAxisLabelCommand.describe("Sets the X label of the plot",
424
+ TitleLabelCommand.describe("Sets the title of the plot",
334
425
  <<"EOH", AxisGroup)
335
- Sets the X label of the current plot.
426
+ Sets the title of the current plot.
336
427
  EOH
337
428
 
338
- NoXAxisLabelCommand =
339
- Cmd.new('no-xlabel', nil, '--no-xlabel', []) do |plotmaker|
429
+ NoTitleLabelCommand =
430
+ Cmd.new('no-title', nil, '--no-title', []) do |plotmaker|
340
431
  PlotStyle.current_plot_style(plotmaker).
341
- set_label_style('x_label', {}, false)
432
+ set_label_style('title', {}, false)
342
433
  end
343
434
 
344
- NoXAxisLabelCommand.describe("Disables X label for the plot",
435
+ NoTitleLabelCommand.describe("Disables title for the plot",
345
436
  <<"EOH", AxisGroup)
346
- Disables the X label for the current plot.
437
+ Removes the title of the current plot.
347
438
  EOH
348
439
 
349
-
350
- YAxisLabelCommand =
351
- Cmd.new('ylabel', '-y', '--ylabel', [ CmdArg.new('text') ],
352
- FullTextStyleOptions) do |plotmaker, label, options|
353
- PlotStyle.current_plot_style(plotmaker).
354
- set_label_style('y_label', options, label)
440
+ X2Command =
441
+ Cmd.new('x2', nil, '--x2', []) do |plotmaker|
442
+ plotmaker.interpreter.
443
+ run_commands("xaxis(top)\naxis-style(top,decoration=full)")
355
444
  end
356
445
 
357
- YAxisLabelCommand.describe("Sets the Y label of the plot",
358
- <<"EOH", AxisGroup)
359
- Sets the Y label of the current plot.
446
+ X2Command.describe("Switches to top axis for subsequent curves",
447
+ <<"EOH", AxisGroup)
448
+ Switches to using the top axis for X axis for the subsequent curves,
449
+ and turns on full decoration for the right axis. Shortcut for:
450
+
451
+ # xaxis(top)
452
+ # axis-style(top,decoration=full)
360
453
  EOH
361
454
 
362
- NoYAxisLabelCommand =
363
- Cmd.new('no-ylabel', nil, '--no-ylabel', []) do |plotmaker|
364
- PlotStyle.current_plot_style(plotmaker).
365
- set_label_style('y_label', {}, false)
455
+ Y2Command =
456
+ Cmd.new('y2', nil, '--y2', []) do |plotmaker|
457
+ plotmaker.interpreter.
458
+ run_commands("yaxis(right)\naxis-style(right,decoration=full)")
366
459
  end
367
460
 
368
- NoYAxisLabelCommand.describe("Disables Y label for the plot",
461
+ Y2Command.describe("Switches to right axis for subsequent curves",
369
462
  <<"EOH", AxisGroup)
370
- Disables the Y label for the current plot.
463
+ Switches to using the right axis for Y axis for the subsequent curves,
464
+ and turns on full decoration for the right axis. Shortcut for:
465
+
466
+ # yaxis(right)
467
+ # axis-style(right,decoration=full)
371
468
  EOH
372
469
 
373
- TitleLabelCommand =
374
- Cmd.new('title', '-t', '--title', [ CmdArg.new('text') ],
375
- FullTextStyleOptions) do |plotmaker, label, options|
470
+ NewZAxisCommand =
471
+ Cmd.new('new-zaxis', nil, '--new-zaxis',
472
+ [
473
+ CmdArg.new('text')
474
+ ],ZAxisStyle) do |plotmaker, name, options|
475
+ axis = Styles::MapAxisStyle.new
376
476
  PlotStyle.current_plot_style(plotmaker).
377
- set_label_style('title', options, label)
477
+ set_axis_style(name, axis)
478
+ axis.set_from_hash(options)
378
479
  end
379
-
380
- TitleLabelCommand.describe("Sets the title of the plot",
381
- <<"EOH", AxisGroup)
382
- Sets the title of the current plot.
480
+
481
+ NewZAxisCommand.
482
+ describe("Creates a Z axis",
483
+ <<"EOH", AxisGroup)
484
+ Creates a named Z axis that can display information from Z color maps
383
485
  EOH
384
486
 
487
+
385
488
  LabelStyleCommand =
386
489
  Cmd.new('label-style', nil, '--label-style',
387
490
  [ CmdArg.new('label') ], # Here: change the label too...
@@ -396,7 +499,7 @@ Sets the style of the given label (see the type {type: label} for more
396
499
  information).
397
500
 
398
501
  The option text permits to also set the text of the label (does not
399
- work for ticks).
502
+ work for ticks).
400
503
 
401
504
  For tick labels, setting the color option also sets the color for the
402
505
  lines of the corresponding axis. If you don't want that, you can