When using a plot generator object, it is possible to specify one of three output themes: light
, dark
and current
.
light
theme
The light theme produces plots with a white background and a black foreground color. This is the default theme:
import polars as pl
from pyobsplot import Obsplot, Plot, d3, js
stocks = pl.read_csv("data/stocks.csv", try_parse_dates=True)
Plot.plot(
{
"y": {"grid": True},
"color": {"legend": True},
"marks": [
Plot.lineY(
stocks, {"x": "Date", "y": "Close", "stroke": "Symbol", "tip": True}
)
],
},
theme="light"
)
AAPLAMZNGOOGIBM
dark
theme
The dark theme produces plots with a black background and a white foreground color.
Plot.plot(
{
"y": {"grid": True},
"color": {"legend": True},
"marks": [
Plot.lineY(
stocks, {"x": "Date", "y": "Close", "stroke": "Symbol", "tip": True}
)
],
},
theme="dark"
)
AAPLAMZNGOOGIBM
current
theme
The “current” theme uses a transparent background and a currentColor
foreground, so it should keep the current color theme:
Plot.plot(
{
"y": {"grid": True},
"color": {"legend": True},
"marks": [
Plot.lineY(
stocks, {"x": "Date", "y": "Close", "stroke": "Symbol", "tip": True}
)
],
},
theme="current"
)
AAPLAMZNGOOGIBM