Skip to content

Commit 904f079

Browse files
committed
MEP12 compliance demo_axisline_style.py
The example is split in two (one for subplotzero axes one for style of axes) and cleaned according to MEP12 (including renaming to plot for sphinx)
1 parent 23afcb4 commit 904f079

2 files changed

Lines changed: 42 additions & 3 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
========================
3+
Customize the axis style
4+
========================
5+
6+
This example demonstrates how to customize axes style of a Subplot.
7+
"""
8+
9+
import numpy as np
10+
11+
import matplotlib.pyplot as plt
12+
13+
from mpl_toolkits.axisartist.axislines import Subplot
14+
15+
if 1:
16+
fig = plt.figure(1)
17+
ax = Subplot(fig, 111)
18+
fig.add_subplot(ax)
19+
20+
for direction in ["left", "bottom"]:
21+
ax.axis[direction].set_axisline_style("-|>")
22+
23+
x = np.linspace(-0.5, 1., 100)
24+
ax.plot(x, np.sin(x*np.pi))
25+
26+
plt.show()

examples/axisartist/demo_axisline_style.py renamed to examples/axisartist/plot_subplotzero.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,30 @@
1+
"""
2+
==========================
3+
Create zero-centered axes.
4+
==========================
5+
6+
This example demonstrates how to use SubplotZero to create
7+
zero-centered axes.
8+
"""
19

2-
from mpl_toolkits.axisartist.axislines import SubplotZero
3-
import matplotlib.pyplot as plt
410
import numpy as np
511

12+
import matplotlib.pyplot as plt
13+
14+
from mpl_toolkits.axisartist.axislines import SubplotZero
15+
616
if 1:
717
fig = plt.figure(1)
818
ax = SubplotZero(fig, 111)
919
fig.add_subplot(ax)
1020

21+
# Display the zero-centered axes
22+
1123
for direction in ["xzero", "yzero"]:
12-
ax.axis[direction].set_axisline_style("-|>")
1324
ax.axis[direction].set_visible(True)
1425

26+
# Disable the box axes
27+
1528
for direction in ["left", "right", "bottom", "top"]:
1629
ax.axis[direction].set_visible(False)
1730

0 commit comments

Comments
 (0)