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

Skip to content

Commit 587b553

Browse files
committed
Move axisartist examples to their folder.
1 parent 64874e5 commit 587b553

19 files changed

+119
-162
lines changed

examples/axes_grid1/simple_axisline4.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""
77
import matplotlib.pyplot as plt
88
from mpl_toolkits.axes_grid1 import host_subplot
9-
import mpl_toolkits.axisartist as AA
109
import numpy as np
1110

1211
ax = host_subplot(111)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"""
2+
==================
3+
Demo Parasite Axes
4+
==================
5+
6+
"""
7+
from mpl_toolkits.axisartist.parasite_axes import HostAxes, ParasiteAxes
8+
import matplotlib.pyplot as plt
9+
10+
11+
fig = plt.figure(1)
12+
13+
host = HostAxes(fig, [0.15, 0.1, 0.65, 0.8])
14+
par1 = ParasiteAxes(host, sharex=host)
15+
par2 = ParasiteAxes(host, sharex=host)
16+
host.parasites.append(par1)
17+
host.parasites.append(par2)
18+
19+
host.set_ylabel("Density")
20+
host.set_xlabel("Distance")
21+
22+
host.axis["right"].set_visible(False)
23+
par1.axis["right"].set_visible(True)
24+
par1.set_ylabel("Temperature")
25+
26+
par1.axis["right"].major_ticklabels.set_visible(True)
27+
par1.axis["right"].label.set_visible(True)
28+
29+
par2.set_ylabel("Velocity")
30+
offset = (60, 0)
31+
new_axisline = par2._grid_helper.new_fixed_axis
32+
par2.axis["right2"] = new_axisline(loc="right", axes=par2, offset=offset)
33+
34+
fig.add_axes(host)
35+
36+
host.set_xlim(0, 2)
37+
host.set_ylim(0, 2)
38+
39+
host.set_xlabel("Distance")
40+
host.set_ylabel("Density")
41+
par1.set_ylabel("Temperature")
42+
43+
p1, = host.plot([0, 1, 2], [0, 1, 2], label="Density")
44+
p2, = par1.plot([0, 1, 2], [0, 3, 2], label="Temperature")
45+
p3, = par2.plot([0, 1, 2], [50, 30, 15], label="Velocity")
46+
47+
par1.set_ylim(0, 4)
48+
par2.set_ylim(1, 65)
49+
50+
host.legend()
51+
52+
host.axis["left"].label.set_color(p1.get_color())
53+
par1.axis["right"].label.set_color(p2.get_color())
54+
par2.axis["right2"].label.set_color(p3.get_color())
55+
56+
plt.show()
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""
2+
===============
3+
Simple Axisline
4+
===============
5+
6+
"""
7+
import matplotlib.pyplot as plt
8+
9+
from mpl_toolkits.axisartist.axislines import SubplotZero
10+
11+
12+
fig = plt.figure(1)
13+
fig.subplots_adjust(right=0.85)
14+
ax = SubplotZero(fig, 1, 1, 1)
15+
fig.add_subplot(ax)
16+
17+
# make right and top axis invisible
18+
ax.axis["right"].set_visible(False)
19+
ax.axis["top"].set_visible(False)
20+
21+
# make xzero axis (horizontal axis line through y=0) visible.
22+
ax.axis["xzero"].set_visible(True)
23+
ax.axis["xzero"].label.set_text("Axis Zero")
24+
25+
ax.set_ylim(-2, 4)
26+
ax.set_xlabel("Label X")
27+
ax.set_ylabel("Label Y")
28+
# or
29+
#ax.axis["bottom"].label.set_text("Label X")
30+
#ax.axis["left"].label.set_text("Label Y")
31+
32+
# make new (right-side) yaxis, but wth some offset
33+
offset = (20, 0)
34+
new_axisline = ax.get_grid_helper().new_fixed_axis
35+
36+
ax.axis["right2"] = new_axisline(loc="right", offset=offset, axes=ax)
37+
ax.axis["right2"].label.set_text("Label Y2")
38+
39+
ax.plot([-2, 3, 2])
40+
plt.show()

examples/userdemo/demo_parasite_axes_sgskip.py

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

examples/userdemo/simple_axisline.py

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

0 commit comments

Comments
 (0)