tueplots.axes module

tueplots.axes module#

Customise matplotlib axes (tueplots.axes).

Provides functions to adjust axis appearance, including grid lines, spines, ticks, and legends.

Examples

>>> import matplotlib.pyplot as plt
>>> from tueplots import axes
>>>
>>> # Select a style bundle
>>> style = axes.spines(right=False, top=False)
>>>
>>> # Apply the style to matplotlib
>>> plt.rcParams.update(style)
>>>
>>> # Create a plot
>>> fig, ax = plt.subplots()
>>> ax.plot([0, 1, 2], [2, 1, 3])
>>> ax.set_xlabel("$x$ label")
>>> ax.set_ylabel("$y$ label")
>>> plt.show()

(Source code, png, hires.png, pdf)

../_images/tueplots-axes-1.png
tueplots.axes.color(*, base='black', face='none')[source]#

Adjust the axes’ color.

tueplots.axes.grid(*, grid_alpha=0.2, grid_linestyle='solid')[source]#

Adjust the grid-style.

tueplots.axes.legend(*, shadow=False, frameon=True, fancybox=False)[source]#

Adjust the legend-style.

tueplots.axes.lines(*, base_width=0.5, line_base_ratio=2.0, tick_major_base_ratio=1.0, tick_minor_base_ratio=0.5, tick_size_width_ratio=3.0, tick_major_size_min=3.0, tick_minor_size_min=2.0, axisbelow=True)[source]#

Adjust linewidth(s) according to a base width.

tueplots.axes.spines(*, left=True, right=True, top=True, bottom=True)[source]#

Adjust the visibility of the axes’ spines.

tueplots.axes.tick_direction(*, x='inout', y='inout')[source]#

Adjust the tick direction.