8000 Separate plots using #### in demo_fixed_size_axes.py (#15427) · matplotlib/matplotlib@c22c76f · GitHub
[go: up one dir, main page]

Skip to content

Commit c22c76f

Browse files
jgtiutimhoffm
authored andcommitted
Separate plots using #### in demo_fixed_size_axes.py (#15427)
* Separate plots using #### in demo_fixed_size_axes.py * Update demo_fixed_size_axes.py to be Flake 8 compliant * Rewrite commands as top-level code
1 parent 1c6ee08 commit c22c76f

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed

examples/axes_grid1/demo_fixed_size_axes.py

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,47 +9,42 @@
99
from mpl_toolkits.axes_grid1 import Divider, Size
1010
from mpl_toolkits.axes_grid1.mpl_axes import Axes
1111

12+
###############################################################################
1213

13-
def demo_fixed_size_axes():
14-
fig = plt.figure(figsize=(6, 6))
1514

16-
# The first items are for padding and the second items are for the axes.
17-
# sizes are in inch.
18-
h = [Size.Fixed(1.0), Size.Fixed(4.5)]
19-
v = [Size.Fixed(0.7), Size.Fixed(5.)]
15+
fig = plt.figure(figsize=(6, 6))
2016

21-
divider = Divider(fig, (0.0, 0.0, 1., 1.), h, v, aspect=False)
22-
# the width and height of the rectangle is ignored.
17+
# The first items are for padding and the second items are for the axes.
18+
# sizes are in inch.
19+
h = [Size.Fixed(1.0), Size.Fixed(4.5)]
20+
v = [Size.Fixed(0.7), Size.Fixed(5.)]
2321

24-
ax = Axes(fig, divider.get_position())
25-
ax.set_axes_locator(divider.new_locator(nx=1, ny=1))
22+
divider = Divider(fig, (0.0, 0.0, 1., 1.), h, v, aspect=False)
23+
# the width and height of the rectangle is ignored.
2624

27-
fig.add_axes(ax)
25+
ax = Axes(fig, divider.get_position())
26+
ax.set_axes_locator(divider.new_locator(nx=1, ny=1))
2827

29-
ax.plot([1, 2, 3])
28+
fig.add_axes(ax)
3029

30+
ax.plot([1, 2, 3])
3131

32-
def demo_fixed_pad_axes():
33-
fig = plt.figure(figsize=(6, 6))
32+
###############################################################################
3433

35-
# The first & third items are for padding and the second items are for the
36-
# axes. Sizes are in inches.
37-
h = [Size.Fixed(1.0), Size.Scaled(1.), Size.Fixed(.2)]
38-
v = [Size.Fixed(0.7), Size.Scaled(1.), Size.Fixed(.5)]
3934

40-
divider = Divider(fig, (0.0, 0.0, 1., 1.), h, v, aspect=False)
41-
# the width and height of the rectangle is ignored.
35+
fig = plt.figure(figsize=(6, 6))
4236

43-
ax = Axes(fig, divider.get_position())
44-
ax.set_axes_locator(divider.new_locator(nx=1, ny=1))
37+
# The first & third items are for padding and the second items are for the
38+
# axes. Sizes are in inches.
39+
h = [Size.Fixed(1.0), Size.Scaled(1.), Size.Fixed(.2)]
40+
v = [Size.Fixed(0.7), Size.Scaled(1.), Size.Fixed(.5)]
4541

46-
fig.add_axes(ax)
42+
divider = Divider(fig, (0.0, 0.0, 1., 1.), h, v, aspect=False)
43+
# the width and height of the rectangle is ignored.
4744

48-
ax.plot([1, 2, 3])
45+
ax = Axes(fig, divider.get_position())
46+
ax.set_axes_locator(divider.new_locator(nx=1, ny=1))
4947

48+
fig.add_axes(ax)
5049

51-
if __name__ == "__main__":
52-
demo_fixed_size_axes()
53-
demo_fixed_pad_axes()
54-
55-
plt.show()
50+
ax.plot([1, 2, 3])

0 commit comments

Comments
 (0)
0