Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 18cf273

Browse filesBrowse files
committed
Merge pull request #952 from pelson/gridspec_demo_fix
Fix to gridspec06 demo
2 parents 70c2cbb + bbc2899 commit 18cf273
Copy full SHA for 18cf273

File tree

Expand file treeCollapse file tree

2 files changed

+7
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-5
lines changed

‎doc/users/plotting/examples/demo_gridspec06.py

Copy file name to clipboardExpand all lines: doc/users/plotting/examples/demo_gridspec06.py
+4-4Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,9 @@ 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+
# make a key for the subplot (which includes the axes object id
795+
# in the hash)
796+
key = self._make_key(*args, **kwargs)
795797
else:
796798
projection_class, kwargs, key = \
797799
process_projection_requirements(self, *args, **kwargs)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.