Class: CTioga2::Graphics::Elements::Subplot
- Inherits:
-
Container
- Object
- TiogaElement
- Container
- CTioga2::Graphics::Elements::Subplot
- Defined in:
- lib/ctioga2/graphics/elements/subplot.rb
Overview
A subplot. It features:
-
inclusion of curves
-
legends
-
a way to set/get its figure boundaries.
Instance Attribute Summary collapse
-
#count_boundaries ⇒ Object
Whether or not the parent object should take the boundaries into account or not for its own internal boundaries.
-
#real_boundaries ⇒ Object
A Boundaries object representing the boundaries in effect.
-
#style ⇒ Object
Various stylistic aspects of the plot, as a Styles::PlotStyle object.
-
#user_boundaries ⇒ Object
A Boundaries object representing the boundaries imposed by the user.
Attributes inherited from Container
#elements, #legend_area, #legend_storage, #root_object, #subframe
Attributes inherited from TiogaElement
Instance Method Summary collapse
-
#get_boundaries ⇒ Object
Returns the boundaries of the SubPlot.
-
#initialize(parent, root, style) ⇒ Subplot
constructor
A new instance of Subplot.
Methods inherited from Container
#add_element, #add_legend_item, #size
Methods inherited from TiogaElement
Methods included from Log
debug, error, fatal, #format_exception, #identify, info, init_logger, logger, set_level, #spawn, warn
Constructor Details
#initialize(parent, root, style) ⇒ Subplot
Returns a new instance of Subplot.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ctioga2/graphics/elements/subplot.rb', line 48 def initialize(parent, root, style) super(parent, root) @user_boundaries = Types::Boundaries.new(nil, nil, nil, nil) @real_boundaries = nil @subframe = Types::MarginsBox.new("2.8dy", "2.8dy", "2.8dy", "2.8dy") @subframe = nil # Automatic by default. @style = style || Styles::PlotStyle.new # By default, boundaries do not count for the parent @count_boundaries = false end |
Instance Attribute Details
#count_boundaries ⇒ Object
Whether or not the parent object should take the boundaries into account or not for its own internal boundaries.
46 47 48 |
# File 'lib/ctioga2/graphics/elements/subplot.rb', line 46 def count_boundaries @count_boundaries end |
#real_boundaries ⇒ Object
A Boundaries object representing the boundaries in effect. Only filled with meaningful values from within the real_do function.
38 39 40 |
# File 'lib/ctioga2/graphics/elements/subplot.rb', line 38 def real_boundaries @real_boundaries end |
#style ⇒ Object
Various stylistic aspects of the plot, as a Styles::PlotStyle object.
42 43 44 |
# File 'lib/ctioga2/graphics/elements/subplot.rb', line 42 def style @style end |
#user_boundaries ⇒ Object
A Boundaries object representing the boundaries imposed by the user.
33 34 35 |
# File 'lib/ctioga2/graphics/elements/subplot.rb', line 33 def user_boundaries @user_boundaries end |
Instance Method Details
#get_boundaries ⇒ Object
Returns the boundaries of the SubPlot.
66 67 68 69 70 71 72 73 74 |
# File 'lib/ctioga2/graphics/elements/subplot.rb', line 66 def get_boundaries # raw boundaries bounds = get_elements_boundaries if @style.plot_margin bounds.apply_margin!(@style.plot_margin) end bounds.override_boundaries(@user_boundaries) return bounds end |