Plot Styler API

class pynamicalsys.core.plot_styler.PlotStyler(fontsize: int = 20, legend_fontsize: int = 14, axes_linewidth: float = 1.3, font_family: str = 'STIXGeneral', tick_direction_in: bool = True, minor_ticks_visible: bool = False, linewidth: float = 1.0, markersize: float = 5.0, markeredgewidth: float = 1.0, markeredgecolor: str = 'black', ticks_on_all_sides: bool = True)[source]

Bases: object

A utility class to globally configure and apply consistent styling for Matplotlib plots.

This class sets default plot aesthetics such as font sizes, line widths, marker styles, tick behavior, and more, using Matplotlib’s rcParams. It ensures consistent visual style across multiple figures and subplots with minimal repetitive code.

Parameters

fontsizeint, default=20

Base font size for labels, titles, and text.

legend_fontsizeint, default=14

Font size for the legend.

axes_linewidthfloat, default=1.3

Width of the axes borders.

font_familystr, default=”STIXGeneral”

Font family used for text and math rendering.

line_widthfloat, default=2.0

Default line width for plot lines.

markersizefloat, default=6.0

Default marker size for lines with markers.

markeredgewidthfloat, default=1.0

Edge width for plot markers.

markeredgecolorstr, default=”black”

Edge color for plot markers.

tick_direction_inbool, default=True

Whether ticks point inward (True) or outward (False).

minor_ticks_visiblebool, default=True

Whether minor ticks are visible.

Methods

apply_style()

Applies the defined styling parameters globally using Matplotlib’s rcParams.

set_tick_padding(ax, pad_x=None, pad_y=None)

Sets custom padding between axis ticks and labels for a given Axes object.

apply_style() None[source]

Apply global matplotlib styling.

set_tick_padding(ax: Axes, pad_x: int | None = None, pad_y: int | None = None) None[source]

Set custom tick padding for a single Axes.

Parameters

axmatplotlib Axes

The axes object to modify.

pad_xint, optional

Padding for x-axis major ticks.

pad_yint, optional

Padding for y-axis major ticks.