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 b9ed974

Browse filesBrowse files
author
none
committed
Allow "figure" kwarg for host functions in parasite_axes.
1 parent 2c95107 commit b9ed974
Copy full SHA for b9ed974

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed

‎lib/mpl_toolkits/axes_grid1/parasite_axes.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axes_grid1/parasite_axes.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,10 @@ def host_axes(*args, **kwargs):
487487
import matplotlib.pyplot as plt
488488
axes_class = kwargs.pop("axes_class", None)
489489
host_axes_class = host_axes_class_factory(axes_class)
490-
fig = plt.gcf()
490+
if "figure" in kwargs:
491+
fig = kwargs["figure"]
492+
else:
493+
fig = plt.gcf()
491494
ax = host_axes_class(fig, *args, **kwargs)
492495
fig.add_axes(ax)
493496
plt.draw_if_interactive()
@@ -497,7 +500,10 @@ def host_subplot(*args, **kwargs):
497500
import matplotlib.pyplot as plt
498501
axes_class = kwargs.pop("axes_class", None)
499502
host_subplot_class = host_subplot_class_factory(axes_class)
500-
fig = plt.gcf()
503+
if "figure" in kwargs:
504+
fig = kwargs["figure"]
505+
else:
506+
fig = plt.gcf()
501507
ax = host_subplot_class(fig, *args, **kwargs)
502508
fig.add_subplot(ax)
503509
plt.draw_if_interactive()

0 commit comments

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