element_rect#

element_rect(fill=None, color=None, size=None, linetype=None, blank=False) dict#

Specify how non-data components of the plot are drawn. This theme element draws borders and backgrounds.

Parameters:
fillstr

Fill color.

colorstr

Border color.

sizeint

Border size.

linetypeint or str or list

Type of the line. Accepts the following values:

  • Codes or names: 0 = ‘blank’, 1 = ‘solid’, 2 = ‘dashed’, 3 = ‘dotted’, 4 = ‘dotdash’, 5 = ‘longdash’, 6 = ‘twodash’.

  • A string of an even number (up to eight) of hexadecimal digits, specifying the lengths in consecutive positions.

  • A list defines the pattern of dashes and gaps, either with an offset: [offset, [dash, gap, …]], or without an offset: [dash, gap, …].

For more info see Line Types.

blankbool, default=False

If True - draws nothing, and assigns no space.

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')) + geom_histogram() + \
7    theme(panel_background=element_rect(fill='#f7fcf5'))