plot
thmd.plot
¶
This module provides functions and class to produce publication-quality figures. The main idea is to create a handy class which setup all necessary parameters for plotting, and then just call its methods to produce the publication-quality figures.
The core class is the Plotter
, which is built on top of matplotlib.pyplot
. The Plotter
, therefore, has all useful functions from matplotlib.pyplot
.
Assume we have a data frame df
:
import numpy as np
import polars as pl
x = np.arange(0, 1000)
df = pl.DataFrame({'x': x, 'y': x**2})
Then, use the Plotter().plt
to plot the data as a normal matplotlib.pyplot
object. Adapt all functions from matplotlib.pyplot
.
from thmd.plot import Plotter
plt = Plotter(style='thang').plt
plt.plot(df['x'], df['y'])
plt.show()
Refs
- Customizing Matplotlib with style sheets and rcParams
- Figure size Elsevier
- Single column: W = 90 mm (~3.5 in). H = W*⅘ = 2.8
- Double column: W = 190 mm (~7.5 in). H = 6
Classes:
-
Plotter
–Class to produce publication-quality figures with matplotlib.
Functions:
-
custom_styles
–style for matplotlib
Plotter()
¶
Class to produce publication-quality figures with matplotlib.
Parameters:
-
style
(str
) –the plotting style.
Examples:
Methods:
-
get_plt
–Shortcut to the
matplotlib.pyplot
object. -
set_minor_locator
–Set minor locator for axes
-
get_PdfPages
–shortcut to
matplotlib.backends.backend_pdf.PdfPages
. -
avail_styles
–List all available styles.
Attributes:
COLOR = _COLOR
instance-attribute
¶
MARKER = _MARKER
instance-attribute
¶
LINE = _LINE
instance-attribute
¶
info
property
¶
get_plt(style: str = 'thang')
¶
Shortcut to the matplotlib.pyplot
object.
set_minor_locator(ax: object, xminor=1, yminor=1)
¶
Set minor locator for axes
get_PdfPages()
¶
shortcut to matplotlib.backends.backend_pdf.PdfPages
.
avail_styles()
¶
List all available styles.
custom_styles()
¶
style for matplotlib