Class: Rust::Plots::GGPlot::ThemeBuilder

Inherits:
ThemeComponentBuilder show all
Defined in:
lib/rust/external/ggplot2/themes.rb

Instance Method Summary collapse

Methods inherited from ThemeComponentBuilder

#[], #alignment_el, #line_el, #numeric_el, #option, #rect_el, #text_el, #unit_el

Constructor Details

#initialize(starting = nil) ⇒ ThemeBuilder

Returns a new instance of ThemeBuilder.



237
238
239
240
# File 'lib/rust/external/ggplot2/themes.rb', line 237

def initialize(starting = nil)
    super("plot")
    @starting = starting
end

Instance Method Details

#axis {|builder| ... } ⇒ Object

Yields:

  • (builder)


250
251
252
253
254
255
256
# File 'lib/rust/external/ggplot2/themes.rb', line 250

def axis
    builder = ThemeAxisBuilder.new
    yield builder
    
    @options.merge!(builder.build)
    return self
end

#background(value) ⇒ Object



242
243
244
# File 'lib/rust/external/ggplot2/themes.rb', line 242

def background(value)
    self.option('background', rect_el(value))
end

#buildObject



274
275
276
# File 'lib/rust/external/ggplot2/themes.rb', line 274

def build
    return Theme.new(@starting, **@options)
end

#legend {|builder| ... } ⇒ Object

Yields:

  • (builder)


258
259
260
261
262
263
264
# File 'lib/rust/external/ggplot2/themes.rb', line 258

def legend
    builder = ThemeLegendBuilder.new
    yield builder
    
    @options.merge!(builder.build)
    return self
end

#panel {|builder| ... } ⇒ Object

Yields:

  • (builder)


266
267
268
269
270
271
272
# File 'lib/rust/external/ggplot2/themes.rb', line 266

def panel
    builder = ThemePanelBuilder.new
    yield builder
    
    @options.merge!(builder.build)
    return self
end

#title(value) ⇒ Object



246
247
248
# File 'lib/rust/external/ggplot2/themes.rb', line 246

def title(value)
    self.option('title', text_el(value))
end