rizer.misc.plt_utils#
Functions#
|
Set the matplotlib style for plots. |
|
Save the current figure to a file in the figures folder. |
|
Align zeros of the two axes, zooming them out by same ratio. |
|
Align zeros of multiple axes, zooming them out by same ratio. |
|
Return the LaTeX representation of a chemical species. |
Module Contents#
- rizer.misc.plt_utils.set_mpl_style(nb_columns: int = 2) None#
Set the matplotlib style for plots.
- Parameters:
nb_columns (
int, optional) – Number of columns for the figure style. Options are 1 or 2. By default 2.
- rizer.misc.plt_utils.save_current_figure(fig: matplotlib.figure.Figure, filename: str) None#
Save the current figure to a file in the figures folder.
- Parameters:
fig (
matplotlib.figure.Figure) – Matplotlib figure to save.filename (
str) – Name of the file to save the figure to.
- rizer.misc.plt_utils.align_yaxis_np(ax1: matplotlib.axes.Axes, ax2: matplotlib.axes.Axes) None#
Align zeros of the two axes, zooming them out by same ratio.
Script taken from [SSO_shared_origin].
- Parameters:
ax1 (
matplotlib.axes.Axes) – First axis.ax2 (
matplotlib.axes.Axes) – Second axis.
References
- rizer.misc.plt_utils.align_zeros(axes: list[matplotlib.axes.Axes]) None#
Align zeros of multiple axes, zooming them out by same ratio.
- Parameters:
axes (
listofmatplotlib.axes.Axes) – List of axes to align.
Notes
This function modifies the y-limits of the axes in place. It ensures that all axes have the same zero point and that the y-limits are adjusted to fit the data while maintaining the zero alignment.
References
- rizer.misc.plt_utils.get_species_in_latex(species: str) str#
Return the LaTeX representation of a chemical species.
- Parameters:
species (
str) – Chemical species as a string.- Returns:
LaTeX representation of the chemical species.
- Return type:
Examples
>>> get_species_in_latex("O2") '$\\mathregular{O_{2}}$' >>> get_species_in_latex("CH4") '$\\mathregular{CH_{4}}$' >>> get_species_in_latex("CH4+") '$\\mathregular{CH_{4}^{+}}$' >>> get_species_in_latex("e-") '$\\mathregular{e^{-}}$' >>> get_species_in_latex("C2H6") '$\\mathregular{C_{2}H_{6}}$' >>> get_species_in_latex("C++") '$\\mathregular{C^{++}}$' >>> get_species_in_latex("C(soot)") '$\\mathregular{C}(\\mathregular{soot})$' >>> get_species_in_latex("C(s)") '$\\mathregular{C}(\\mathregular{s})$' >>> get_species_in_latex("C+") '$\\mathregular{C^{+}}$' >>> get_species_in_latex("C++") '$\\mathregular{C^{++}}$' >>> get_species_in_latex("C+++") '$\\mathregular{C^{3+}}$'