| search |
|
|---|
A style holds matplotlib's own settings and LBD's own choices. Every setting, with its type, default and allowed values, is listed in Style settings and matplotlib's settings; how presets, files and overrides combine is in How styles work.
Style
├── lbd_style: 4 the style's format
├── rcparams: {name: value} matplotlib's settings, e.g. {"font.size": 9}
├── kwargs: {call: {arg: value}} arguments of the calls LBD makes, e.g. {"scatter": {"s": 9}}
├── lbd: LbdChoices legend, labels, right_axis, colorbar, bars, bars3d, matrix
└── quantities: {name: QuantityStyle}
Style() is LBD's built-in style. Settings are checked when they are set:
s.rcparams["font.size"] = 500 raises StyleError, and so does a setting that doesn't exist
(s.rcparams["font.sise"] = 9) or one a style can't set (s.rcparams["text.usetex"] = True).
s.rc("font.size") reads a value as matplotlib takes it (the style's, else matplotlib's own
default), and model_dump() gives a plain dict.
import lbd.plot as lp
s = lp.load_style("thesis")
s.rcparams["figure.figsize"] = [170 / 25.4, 64 / 25.4] # inches, as matplotlib
s.kwargs["colorbar"]["pad"] = 0.02
s.lbd.legend.max_entries = 8
print(s.size_mm, s.rc("lines.linewidth"))::: lbd.plot.style.Style options: heading_level: 2 members: [rc, kw, colors, figsize, size_mm, dpi, font_size, to_rcparams, save, load, to_mplstyle, diff] show_bases: false