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
@@ -16,7 +16,7 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 95 $', '$Date: 2009-06-25 23:52:42 +0200 (Thu, 25 Jun 2009) $')
19
+ Version::register_svn_info('$Revision: 196 $', '$Date: 2010-11-25 20:15:32 +0100 (Thu, 25 Nov 2010) $')
20
20
 
21
21
  module Graphics
22
22
 
@@ -28,29 +28,22 @@ module CTioga2
28
28
  # * a way to set/get its figure boundaries.
29
29
  class Subplot < Container
30
30
 
31
- # A Boundaries object representing the boundaries imposed by
32
- # the user.
33
- attr_accessor :user_boundaries
34
-
35
- # A Boundaries object representing the boundaries in
36
- # effect. Only filled with meaningful values from within the
37
- # real_do function.
38
- attr_accessor :real_boundaries
39
-
40
31
  # Various stylistic aspects of the plot, as a
41
32
  # Styles::PlotStyle object.
42
33
  attr_accessor :style
43
34
 
44
- # Whether or not the parent object should take the boundaries
45
- # into account or not for its own internal boundaries.
46
- attr_accessor :count_boundaries
47
-
35
+ # User-specified boundaries. It is a hash axis -> SimpleRange,
36
+ # where the axis is a valid return value of PlotStyle#get_axis_key
37
+ attr_accessor :user_boundaries
38
+
39
+ # Computed boundaries. It also is a hash axis -> SimpleRange,
40
+ # just as #user_boundaries. Its value is not defined as long
41
+ # as #real_do hasn't been entered into.
42
+ attr_accessor :computed_boundaries
43
+
48
44
  def initialize(parent, root, style)
49
45
  super(parent, root)
50
46
 
51
- @user_boundaries = Types::Boundaries.new(nil, nil, nil, nil)
52
- @real_boundaries = nil
53
-
54
47
  @subframe = Types::MarginsBox.new("2.8dy", "2.8dy",
55
48
  "2.8dy", "2.8dy")
56
49
 
@@ -58,30 +51,83 @@ module CTioga2
58
51
 
59
52
  @style = style || Styles::PlotStyle.new
60
53
 
61
- # By default, boundaries do not count for the parent
62
- @count_boundaries = false
54
+ @user_boundaries = {}
55
+ end
56
+
57
+ # Returns the boundaries that apply for the given _curve_ --
58
+ # it reads the curve's axes. #compute_boundaries must have
59
+ # been called beforehand, which means that it will only work
60
+ # from within #real_do.
61
+ #
62
+ # \todo This should not only apply to curves, but to any
63
+ # object. That also means that there should be a way to
64
+ # specify axes for them too.
65
+ def get_el_boundaries(el)
66
+ return get_given_boundaries(* el.location.get_axis_keys(style))
63
67
  end
64
68
 
65
- # Returns the boundaries of the SubPlot.
69
+ # Returns the boundaries of the *default* axes. Plotting
70
+ # functions may safely assume that they are drawn using these
71
+ # boundaries, unless they asked for being drawn onto different
72
+ # axes.
66
73
  def get_boundaries
74
+ return get_given_boundaries(style.xaxis_location,
75
+ style.yaxis_location)
76
+ end
77
+
78
+ # Sets the user boundaries for the given (named) axis:
79
+ def set_user_boundaries(axis, bounds)
80
+ key = @style.get_axis_key(axis)
81
+ @user_boundaries[key] = Types::SimpleRange.new(bounds)
82
+ end
83
+
84
+ def actual_subframe(t)
85
+ return @subframe || @style.estimate_margins(t)
86
+ end
87
+
88
+ # In general, subplot's boundaries do not count for the parent
89
+ # plot.
90
+ def count_boundaries?
91
+ return false
92
+ end
93
+
94
+ protected
95
+
96
+ # Makes up a Boundaries object from two axes keys
97
+ def get_given_boundaries(horiz, vert)
98
+ if @computed_boundaries
99
+ return Types::Boundaries.from_ranges(@computed_boundaries[horiz],
100
+ @computed_boundaries[vert])
101
+ else
102
+ return nil
103
+ end
104
+ end
105
+
106
+ def compute_boundaries
67
107
  # raw boundaries
68
108
  bounds = get_elements_boundaries
69
109
  if @style.plot_margin
70
- bounds.apply_margin!(@style.plot_margin)
110
+ for k,b in bounds
111
+ b.apply_margin!(@style.plot_margin)
112
+ end
113
+ end
114
+ for k,b in @user_boundaries
115
+ bounds[k] ||= Types::SimpleRange.new(nil,nil)
116
+ bounds[k].override(b)
71
117
  end
72
- bounds.override_boundaries(@user_boundaries)
73
118
  return bounds
74
119
  end
75
120
 
76
- protected
121
+
77
122
 
78
123
  # Plots all the objects inside the plot.
79
124
  def real_do(t)
80
125
  # First thing, we setup the boundaries
126
+ @computed_boundaries = compute_boundaries
81
127
 
82
- @real_boundaries = get_boundaries
128
+ real_boundaries = get_boundaries
83
129
 
84
- frames = @subframe || @style.estimate_margins(t)
130
+ frames = actual_subframe(t)
85
131
 
86
132
  # We wrap the call within a subplot
87
133
  t.subplot(frames.to_frame_margins(t)) do
@@ -90,7 +136,7 @@ module CTioga2
90
136
  @style.setup_figure_maker(t)
91
137
 
92
138
  # Manually creating the plot:
93
- t.set_bounds(@real_boundaries.to_a)
139
+ t.set_bounds(real_boundaries.to_a)
94
140
 
95
141
  # Drawing the background elements:
96
142
  t.context do
@@ -101,11 +147,14 @@ module CTioga2
101
147
  @style.draw_all_background_lines(t)
102
148
  i = 0
103
149
  for element in @elements
104
- element.do(t)
150
+ t.context do
151
+ t.set_bounds(get_el_boundaries(element).to_a)
152
+ element.do(t)
153
+ end
105
154
  i += 1
106
155
  end
107
156
  end
108
- @style.draw_all_axes(t)
157
+ @style.draw_all_axes(t, @computed_boundaries)
109
158
 
110
159
  # Now drawing legends:
111
160
  if @legend_area
@@ -121,17 +170,28 @@ module CTioga2
121
170
 
122
171
  # Returns the boundaries of all the elements of this plot.
123
172
  def get_elements_boundaries
124
- elements_bounds = []
173
+ boundaries = {}
125
174
  for el in @elements
126
175
  if el.respond_to? :get_boundaries
127
- if el.respond_to?(:count_boundaries) && ! (el.count_boundaries)
176
+ if el.respond_to?(:count_boundaries?) && ! (el.count_boundaries?)
128
177
  # Ignoring
129
178
  else
130
- elements_bounds << el.get_boundaries
179
+ bounds = el.get_boundaries
180
+ xaxis, yaxis = *el.location.get_axis_keys(style)
181
+ if bounds.is_a? Hash
182
+ ## \todo see if there will ever be a need for a hash
183
+ ## ?
184
+ raise "Not done yet"
185
+ else
186
+ boundaries[xaxis] ||= Types::SimpleRange.new(nil,nil)
187
+ boundaries[xaxis].extend(bounds.horizontal)
188
+ boundaries[yaxis] ||= Types::SimpleRange.new(nil,nil)
189
+ boundaries[yaxis].extend(bounds.vertical)
190
+ end
131
191
  end
132
192
  end
133
193
  end
134
- return Types::Boundaries.overall_bounds(elements_bounds)
194
+ return boundaries
135
195
  end
136
196
 
137
197
  end
@@ -0,0 +1,99 @@
1
+ # tangent.rb: code for drawing tangents
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, but
10
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # General Public License for more details (in the COPYING file).
13
+
14
+
15
+ require 'ctioga2/graphics/elements/primitive'
16
+
17
+ # This module contains all the classes used by ctioga
18
+ module CTioga2
19
+
20
+ Version::register_svn_info('$Revision: 171 $', '$Date: 2010-10-22 17:07:52 +0200 (Fri, 22 Oct 2010) $')
21
+
22
+ module Graphics
23
+
24
+ module Elements
25
+
26
+ module Tangents
27
+
28
+ TangentOptions = {
29
+ 'xfrom' => 'float',
30
+ 'xto' => 'float',
31
+ 'yfrom' => 'float',
32
+ 'yto' => 'float',
33
+ 'xextent' => 'float',
34
+ 'yextent' => 'float',
35
+ 'nbavg' => 'integer'
36
+ }.update(TiogaPrimitiveCall::ArrowOptions)
37
+
38
+ TiogaPrimitiveCall.
39
+ primitive("tangent", "tangent", [ 'data-point'],
40
+ TangentOptions) do |t, point,options|
41
+ options ||= {}
42
+ nb = options['nbavg'] || 7
43
+ x = point.x_val(nb)
44
+ y = point.y_val(nb)
45
+ slope = point.slope(nb)
46
+
47
+ # Now, we parse the head/tail spec.
48
+ if d = options['xextent']
49
+ options['tail'] = [x, y]
50
+ options['head'] = [x+d, y + d*slope]
51
+ elsif d = options['yextent']
52
+ options['tail'] = [x, y]
53
+ options['head'] = [x+d/slope, y + d]
54
+ elsif options['xfrom'] || options['yfrom'] ||
55
+ options['xto'] || options['yto']
56
+ if xf = options['xfrom']
57
+ options['tail'] = [xf, y - (x - xf)*slope]
58
+ elsif yf = options['yfrom']
59
+ options['tail'] = [x - (y-yf)/slope, yf]
60
+ else
61
+ options['tail'] = [x,y]
62
+ end
63
+
64
+ if xt = options['xto']
65
+ options['head'] = [xt, y - (x - xt)*slope]
66
+ elsif yt = options['yto']
67
+ options['head'] = [x - (y-yt)/slope, yt]
68
+ else
69
+ options['head'] = [x,y]
70
+ end
71
+ else
72
+ # We don't bother too much about the head/tail
73
+ options['head'] = [x, y]
74
+ dx = point.dx(nb) * 10
75
+ options['tail'] = [x-dx, y - dx*slope]
76
+ options['line_width'] = 0
77
+ options['tail_marker'] = "None"
78
+ end
79
+
80
+ # We look for any color argument:
81
+ if ! (options['color'] || options['tail_color'] ||
82
+ options['head_color'])
83
+ options['color'] = $last_curve_style.line.color
84
+ end
85
+
86
+ # Now, we delete elements from the hash that don't have
87
+ # anything to do there:
88
+ for k in TangentOptions.keys -
89
+ TiogaPrimitiveCall::ArrowOptions.keys
90
+ options.delete k
91
+ end
92
+
93
+ t.show_arrow(options)
94
+ end
95
+ end
96
+
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,126 @@
1
+ # parametric2d.rb: a 2D curve whose parameters depend on Z values
2
+ # copyright (c) 2006, 2007, 2008, 2009, 2010 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, but
10
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # General Public License for more details (in the COPYING file).
13
+
14
+ require 'ctioga2/utils'
15
+ require 'ctioga2/log'
16
+
17
+ require 'Dobjects/Function'
18
+
19
+
20
+ module CTioga2
21
+
22
+ Version::register_svn_info('$Revision: 198 $', '$Date: 2010-11-30 00:48:23 +0100 (Tue, 30 Nov 2010) $')
23
+
24
+ module Graphics
25
+
26
+ module Elements
27
+
28
+ # This class represents a XY map of Z values, ie something that
29
+ # is represented using an image
30
+ #
31
+ # @todo There should be a way to automatically display level
32
+ # lines, and possibly only that.
33
+ class XYZMap < TiogaElement
34
+
35
+ include Log
36
+ include Dobjects
37
+
38
+ # The Data::Dataset object that should get plotted.
39
+ attr_accessor :dataset
40
+
41
+ # A Styles::CurveStyle object saying how the curve should be
42
+ # drawn.
43
+ #
44
+ # Some of the elements will be overridden.
45
+ attr_accessor :curve_style
46
+
47
+ # The IndexedTable object representing the underlying data
48
+ attr_accessor :table
49
+
50
+
51
+ undef :location=, :location
52
+
53
+ # Creates a new XYZMap object with the given _dataset_ and
54
+ # _style_.
55
+ def initialize(dataset, style = nil)
56
+ @dataset = dataset
57
+ @curve_style = style
58
+ prepare_data
59
+ end
60
+
61
+ # Prepares the internal storage of the data, from the @dataset
62
+ def prepare_data
63
+ @table = @dataset.indexed_table
64
+ end
65
+
66
+ protected :prepare_data
67
+
68
+ # Returns the LocationStyle object of the curve. Returns the
69
+ # one from #curve_style.
70
+ def location
71
+ return @curve_style.location
72
+ end
73
+
74
+ # Returns the Types::Boundaries of this curve.
75
+ def get_boundaries
76
+ return @table.xy_boundaries
77
+ end
78
+
79
+
80
+ ## Actually draws the curve
81
+ def real_do(t)
82
+ debug { "Plotting curve #{inspect}" }
83
+ t.context do
84
+ # Of course, there are still quite a few things to do
85
+ # ;-)...
86
+
87
+ # Ideas: for leaving things out, I may have to use min_gt
88
+ # along with masking.
89
+
90
+ ## @todo handle non-homogeneous XY maps.
91
+
92
+ @curve_style.color_map ||=
93
+ Styles::ColorMap.from_text("Red--Green")
94
+
95
+ dict = @curve_style.color_map.
96
+ prepare_data_display(t,@table.table,
97
+ @table.table.min,
98
+ @table.table.max)
99
+ if @curve_style.zaxis
100
+ begin
101
+ @parent.style.get_axis_style(@curve_style.zaxis).
102
+ set_color_map(@curve_style.color_map,
103
+ @table.table.min,
104
+ @table.table.max)
105
+ rescue
106
+ error { "Could not set Z info to non-existent axis #{@curve_style.zaxis}" }
107
+ end
108
+ end
109
+
110
+ dict.update(@table.corner_positions)
111
+ dict.update('width' => @table.width,
112
+ 'height' => @table.height)
113
+ dict.update('interpolate' => false)
114
+ if (! @curve_style.fill.transparency) ||
115
+ (@curve_style.fill.transparency < 0.99)
116
+ t.show_image(dict)
117
+ else
118
+ info { 'Not showing map as transparency is over 0.99' }
119
+ end
120
+ end
121
+ end
122
+
123
+ end
124
+ end
125
+ end
126
+ end
@@ -18,7 +18,7 @@ require 'ctioga2/graphics/coordinates'
18
18
 
19
19
  module CTioga2
20
20
 
21
- Version::register_svn_info('$Revision: 2 $', '$Date: 2009-04-25 14:03:30 +0200 (Sat, 25 Apr 2009) $')
21
+ Version::register_svn_info('$Revision: 244 $', '$Date: 2011-01-23 23:36:02 +0100 (Sun, 23 Jan 2011) $')
22
22
 
23
23
  module Graphics
24
24
 
@@ -36,33 +36,118 @@ module CTioga2
36
36
  # object.
37
37
  attr_accessor :legend_provider
38
38
 
39
+ # The current kind of generated. It is a symbol
40
+ attr_accessor :current_curves
41
+
39
42
  # Creates a CurveGenerator object.
40
43
  def initialize
41
44
  @legend_provider = Legends::LegendProvider.new
42
45
  @style_factory = Styles::CurveStyleFactory.new
46
+ @current_curves = :xy_plot
43
47
  end
44
48
 
45
49
  # Creates a Elements::TiogaElement representing the _dataset_
46
50
  # and returns it.
47
51
  #
48
- # TODO:
49
- # * coordinate transformations
52
+ # \todo
53
+ # * (other kinds of) coordinate transformations
50
54
  # * other kinds of curves (pseudo-3D, surfaces, histograms...)
51
55
  def curve_from_dataset(plot, dataset, options = {})
56
+ # Does coordinate transforms first ?
57
+ # \todo copy datasets here rather than overwriting them !
58
+ plot.style.transforms.transform_2d!(dataset)
59
+
60
+ return send(@current_curves, plot, dataset, options)
61
+ end
62
+
63
+ private
64
+
65
+ ## \name Available kinds of curves
66
+ #
67
+ # @{
68
+ #
69
+ # The "classical" 2D plots.
70
+ def xy_plot(plot, dataset, options = {})
52
71
  legend = @legend_provider.dataset_legend(dataset)
53
72
  style = @style_factory.next(options)
54
73
  style.legend ||= legend # The legend specified as option to
55
74
  # the --plot command has precedence
56
75
  # over the one specified by --legend.
57
-
58
- # TODO: copy datasets here !
59
- plot.style.transforms.transform_2d!(dataset)
60
76
  curve = Graphics::Elements::Curve2D.new(dataset, style)
61
77
  return curve
62
78
  end
79
+
80
+ # XYZ plots formerly known as "parametric plots"
81
+ def xy_parametric(plot, dataset, options = {})
82
+ legend = @legend_provider.dataset_legend(dataset)
83
+ style = @style_factory.next(options)
84
+ style.legend = false
85
+ style.legend ||= legend # The legend specified as option to
86
+ # the --plot command has precedence
87
+ # over the one specified by --legend.
88
+ curve = Graphics::Elements::Parametric2D.new(dataset, style)
89
+ return curve
90
+ end
91
+
92
+ # XYZ maps
93
+ def xyz_map(plot, dataset, options = {})
94
+ legend = @legend_provider.dataset_legend(dataset)
95
+ style = @style_factory.next(options)
96
+ style.legend = false
97
+ style.legend ||= legend # The legend specified as option to
98
+ # the --plot command has precedence
99
+ # over the one specified by --legend.
100
+ curve = Graphics::Elements::XYZMap.new(dataset, style)
101
+ return curve
102
+ end
103
+
104
+
105
+ ## @}
63
106
 
64
107
  end
65
108
 
109
+
110
+ # The group for chosing plot types.
111
+ PlotTypesGroup =
112
+ CmdGroup.new('plot-types',
113
+ "Switch between different kinds of plots",
114
+ "How to switch between different kinds of plot types", 01)
115
+
116
+
117
+ XYParametricPlotCommand =
118
+ Cmd.new("xy-parametric",nil,"--xy-parametric") do |plotmaker|
119
+ plotmaker.curve_generator.current_curves = :xy_parametric
120
+ end
121
+
122
+ XYParametricPlotCommand.describe('select XY parametric plots',
123
+ <<EOH, PlotTypesGroup)
124
+ Switch to XY parametric plots, that is standard XY plots whose appearance
125
+ (such as color, marker color, and, potentially, marker kinds and more)
126
+ are governed by one (or more ?) Z values.
127
+ EOH
128
+
129
+ XYPlotCommand =
130
+ Cmd.new("xy-plot",nil,"--xy-plot") do |plotmaker|
131
+ plotmaker.curve_generator.current_curves = :xy_plot
132
+ end
133
+
134
+ XYPlotCommand.describe('select XY plots',
135
+ <<EOH, PlotTypesGroup)
136
+ Switch (back) to standard XY plots (ctioga\'s default)
137
+ EOH
138
+
139
+ XYZMapCommand =
140
+ Cmd.new("xyz-map",nil,"--xyz-map") do |plotmaker|
141
+ plotmaker.curve_generator.current_curves = :xyz_map
142
+ end
143
+
144
+ XYZMapCommand.describe('select XYZ maps',
145
+ <<EOH, PlotTypesGroup)
146
+ Switch to XYZ maps, ie plots where the color at a XY location is given by
147
+ its Z value.
148
+ EOH
149
+
150
+
66
151
  end
67
152
  end
68
153