element_geom#

element_geom(pen=None, brush=None, paper=None) dict#

Theme element that specifies custom values for named geom colors used by plot elements.

It allows you to specify custom color values for special named geom colors (“pen”, “brush”, “paper”) that can be referenced in geom parameters such as color, fill, etc.

These names act as indirections: instead of hardcoding a concrete color in a geom (e.g., color="red"), you can use a semantic name (e.g., color="pen") and control its actual value centrally via the theme.

Parameters:
penstr

Color assigned to the named color “pen”. Typically used for stroke/outline rendering (e.g., color='pen').

brushstr

Color assigned to the named color “brush”. Typically used for interior fills or secondary stroke styling (e.g., fill='brush'), depending on the geom.

paperstr

Color assigned to the named color “paper”. Commonly used for background-like fills or lighter interior areas (e.g., fill='paper').

Returns:
dict

Theme element specification.

Examples

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4np.random.seed(42)
 5data = {'x': np.random.normal(size=1000)}
 6ggplot(data, aes(x='x')) + \
 7    geom_histogram(color='pen', fill='paper') + \
 8    theme(geom=element_geom(
 9        pen='dark_blue',
10        paper='light_blue'
11    ))