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

Skip to content

Commit cb436a5

Browse files
author
pelson
committed
Fix gridspec demo
1 parent 70c2cbb commit cb436a5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

doc/users/plotting/examples/demo_gridspec06.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def product(*args, **kwds):
1818
def squiggle_xy(a, b, c, d, i=np.arange(0.0, 2*np.pi, 0.05)):
1919
return np.sin(i*a)*np.cos(i*b), np.sin(i*c)*np.cos(i*d)
2020

21-
f = plt.figure(figsize=(8, 8))
21+
fig = plt.figure(figsize=(8, 8))
2222

2323
# gridspec inside gridspec
2424
outer_grid = gridspec.GridSpec(4, 4, wspace=0.0, hspace=0.0)
@@ -28,13 +28,13 @@ def squiggle_xy(a, b, c, d, i=np.arange(0.0, 2*np.pi, 0.05)):
2828
subplot_spec=outer_grid[i], wspace=0.0, hspace=0.0)
2929
a, b = int(i/4)+1,i%4+1
3030
for j, (c, d) in enumerate(product(range(1, 4), repeat=2)):
31-
ax = plt.Subplot(f, inner_grid[j])
31+
ax = plt.Subplot(fig, inner_grid[j])
3232
ax.plot(*squiggle_xy(a, b, c, d))
3333
ax.set_xticks([])
3434
ax.set_yticks([])
35-
f.add_subplot(ax)
35+
fig.add_subplot(ax)
3636

37-
all_axes = f.get_axes()
37+
all_axes = fig.get_axes()
3838

3939
#show only the outside spines
4040
for ax in all_axes:

lib/matplotlib/figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ def add_subplot(self, *args, **kwargs):
791791

792792
a = args[0]
793793
assert(a.get_figure() is self)
794-
key = self._make_key(*args[1:], **kwargs)
794+
key = self._make_key(*args, **kwargs)
795795
else:
796796
projection_class, kwargs, key = \
797797
process_projection_requirements(self, *args, **kwargs)

0 commit comments

Comments
 (0)