plot_step#

Hist1d.plot_step(ax=None, fname=None, xlabel='__auto__', ylabel='__auto__', title='__auto__', logscale=False, xlim=None, ylim=None, start_at=0.0, savefig_kwargs={}, use_fixed_layout=None, fixed_layout_kwargs=None, make_me_nice=None, make_me_nice_kwargs=None, **plot_kwargs)[source]#

Plot the 1D histogram using matplotlib.pyplot.plot.

Parameters:
fnamestr, optional

If provided, the plot will be saved to this file using matplotlib.figure.Figure.savefig().

xlabelstr, default “__auto__”

Label for the x-axis.

If “__auto__”, use Hist1d.xlabel.

ylabelstr, default “__auto__”

Label for the y-axis.

If “__auto__”, use Hist1d.ylabel.

titlestr, default “__auto__”

Title of the plot.

If “__auto__”, use Hist1d.title.

logscalebool, optional

If True, use a logarithmic y scale.

xlimtuple[float | None, float | None], optional

Limits for the x-axis.

ylimtuple[float | None, float | None], optional

Limits for the y-axis.

start_atfloat or “auto”, default 0.0

Value at which the steps will start and end.

If “auto”, start (end) at first (last) value of Hist1d.values.

savefig_kwargsdict, optional

Additional keyword arguments passed to savefig().

Returns:
tuple of matplotlib.figure.Figure, matplotlib.axes.Axes

A tuple containing the matplotlib Figure and Axes.

Other Parameters:
plot_kwargsdict, optional

Additional keyword arguments passed to matplotlib.pyplot.plot.

Should not contain the drawstyle keyword.

use_fixed_layout

Deprecated since version 5.5.0: Does nothing.

fixed_layout_kwargs

Deprecated since version 5.5.0: Does nothing.

make_me_nice

Deprecated since version 5.5.0: Does nothing.

make_me_nice_kwargs

Deprecated since version 5.5.0: Does nothing.

Examples

import matplotlib.pyplot as plt

import atompy as ap

plt.style.use("atom")

fig, axs = plt.subplots(1, 2, layout="compressed", figsize=(6.4, 3.0))

hist = ap.Hist1d((3, 1, 2, 3, 4), (0, 1, 2, 3, 4, 5))
axs[0].set_title("start_at = 0")
hist.plot_step(ax=axs[0])
axs[1].set_title('start_at = "auto"')
hist.plot_step(ax=axs[1], start_at="auto")

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

../../../_images/plot_step.png