Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a09e77

Browse files
mariamalykhrcomer
mariamalykh
authored andcommitted
replaced step with stairs in basic plot types
Co-authored-by: Maria Malykh <[email protected]>
1 parent 9fdf6ad commit 4a09e77

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

galleries/plot_types/basic/stairs.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
==============
3+
stairs(x, y)
4+
==============
5+
6+
See `~matplotlib.axes.Axes.stairs`.
7+
"""
8+
import matplotlib.pyplot as plt
9+
import numpy as np
10+
11+
plt.style.use('_mpl-gallery')
12+
13+
# make data
14+
x = np.arange(14)
15+
centers = x[:-1] + np.diff(x) / 2
16+
y = -(centers - 4) ** 2 + 8
17+
18+
# plot
19+
fig, ax = plt.subplots()
20+
21+
ax.stairs(y - 1, x, baseline=None, label='stairs()')
22+
plt.plot(centers, y - 1, 'o--', color='grey', alpha=0.3)
23+
24+
ax.set(xlim=(0, 8), xticks=np.arange(1, 8),
25+
ylim=(0, 8), yticks=np.arange(1, 8))
26+
27+
plt.show()

galleries/plot_types/basic/step.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)