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 = 'bw') ⇒ ThemeBuilder

Returns a new instance of ThemeBuilder.



228
229
230
231
# File 'lib/rust/external/ggplot2/themes.rb', line 228

def initialize(starting = 'bw')
    super("plot")
    @starting = starting
end

Instance Method Details

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

Yields:

  • (builder)


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

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

#background(value) ⇒ Object



233
234
235
# File 'lib/rust/external/ggplot2/themes.rb', line 233

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

#buildObject



265
266
267
# File 'lib/rust/external/ggplot2/themes.rb', line 265

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

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

Yields:

  • (builder)


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

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

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

Yields:

  • (builder)


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

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

#title(value) ⇒ Object



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

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