<jupyter_start><jupyter_text>Step DemoThis example demonstrates the use of `.pyplot.step` for piece-wise constantcurves. In particular, it illustrates the effect of the parameter *where*on the step position.The circular markers created with `.pyplot.plot` show the actual datapositions so that it's easier to see the effect of *where*.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt

x = np.arange(14)
y = np.sin(x / 2)

plt.step(x, y + 2, label='pre (default)')
plt.plot(x, y + 2, 'o--', color='grey', alpha=0.3)

plt.step(x, y + 1, where='mid', label='mid')
plt.plot(x, y + 1, 'o--', color='grey', alpha=0.3)

plt.step(x, y, where='post', label='post')
plt.plot(x, y, 'o--', color='grey', alpha=0.3)

plt.grid(axis='x', color='0.95')
plt.legend(title='Parameter where:')
plt.title('plt.step(where=...)')
plt.show()<jupyter_output><empty_output><jupyter_text>The same behavior can be achieved by using the ``drawstyle`` parameter of`.pyplot.plot`.<jupyter_code>plt.plot(x, y + 2, drawstyle='steps', label='steps (=steps-pre)')
plt.plot(x, y + 2, 'o--', color='grey', alpha=0.3)

plt.plot(x, y + 1, drawstyle='steps-mid', label='steps-mid')
plt.plot(x, y + 1, 'o--', color='grey', alpha=0.3)

plt.plot(x, y, drawstyle='steps-post', label='steps-post')
plt.plot(x, y, 'o--', color='grey', alpha=0.3)

plt.grid(axis='x', color='0.95')
plt.legend(title='Parameter drawstyle:')
plt.title('plt.plot(drawstyle=...)')
plt.show()<jupyter_output><empty_output><jupyter_text>------------References""""""""""The use of the following functions, methods, classes and modules is shownin this example:<jupyter_code>import matplotlib
matplotlib.axes.Axes.step
matplotlib.pyplot.step
matplotlib.axes.Axes.plot
matplotlib.pyplot.plot<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1963677639046538, 'fraction_numerical': 0.016458569807037457, 'mean_word_length': 5.602996254681648, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '628741', 'license': 'MIT', 'n_tokens_mistral': 708, 'n_tokens_neox': 656, 'n_words': 158, 'path': 'matplotlib/gallery_jupyter/lines_bars_and_markers/step_demo.ipynb', 'repo_name': 'kingreatwill/penter', 'size': '1762'}