lets_plot.theme

lets_plot.theme(name=None, *, line=None, rect=None, text=None, title=None, axis=None, axis_x=None, axis_y=None, axis_title=None, axis_title_x=None, axis_title_y=None, axis_text=None, axis_text_x=None, axis_text_y=None, axis_ticks=None, axis_ticks_x=None, axis_ticks_y=None, axis_ticks_length=None, axis_ticks_length_x=None, axis_ticks_length_y=None, axis_line=None, axis_line_x=None, axis_line_y=None, legend_text=None, legend_title=None, legend_position=None, legend_justification=None, legend_direction=None, panel_background=None, panel_grid=None, panel_grid_major=None, panel_grid_minor=None, panel_grid_major_x=None, panel_grid_minor_x=None, panel_grid_major_y=None, panel_grid_minor_y=None, plot_title=None, strip_background=None, strip_text=None, axis_tooltip=None, axis_tooltip_x=None, axis_tooltip_y=None)

Use theme() to modify individual components of a theme, allowing you to control the appearance of all non-data components of the plot.

Parameters
  • axis_title (str or FeatureSpec) – Label of axes. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_title_x (str or FeatureSpec) – x axis label. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_title_y (str or FeatureSpec) – y axis label. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_text (str or FeatureSpec) – Tick labels along axes. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_text_x (str or FeatureSpec) – x axis tick labels. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_text_y (str or FeatureSpec) – y axis tick labels. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_ticks (str or FeatureSpec) – Tick marks along axes. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_ticks_x (str or FeatureSpec) – x axis tick marks. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_ticks_y (str or FeatureSpec) – y axis tick marks. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_line (str or FeatureSpec) – Lines along axes. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_line_x (str or FeatureSpec) – Line along x axis. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_line_y (str or FeatureSpec) – Line along y axis. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • legend_position ({‘none’, ‘left’, ‘right’, ‘bottom’, ‘top’} or list) – The position of legends. To remove the plot legend, use the ‘none’ value. If parameter is a list, then it should be a two-element numeric vector, each value of float type between 0 and 1.

  • legend_justification (str or list) – Anchor point for positioning legend. If parameter is a list, then it should be a two-element numeric vector. The pair [0, 0] corresponds to the bottom left corner, the pair [1, 1] corresponds to the top right. For string parameter the only possible value is ‘center’.

  • legend_direction ({‘horizontal’, ‘vertical’}) – Layout of items in legends.

  • axis_tooltip (str or FeatureSpec) – Axes tooltips. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_tooltip_x (str or FeatureSpec) – x axis tooltips. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

  • axis_tooltip_y (str or FeatureSpec) – y axis tooltips. Set ‘blank’ or result of element_blank() to draw nothing and assign no space.

Returns

Theme specification.

Return type

FeatureSpec

Examples

 1import numpy as np
 2from lets_plot import *
 3LetsPlot.setup_html()
 4cats = ['a', 'b', 'c', 'd', 'e']
 5np.random.seed(42)
 6p = np.random.uniform(size=len(cats))
 7x = np.random.choice(cats, p=p/p.sum(), size=1000)
 8ggplot({'x': x}, aes(x='x')) + \
 9    geom_bar(aes(fill='x')) + \
10    scale_fill_discrete(name='cat') + \
11    theme(axis_title_x='blank', axis_text_x='blank', \
12          axis_ticks_x='blank', axis_line='blank', \
13          legend_position='bottom')