-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Merge ParasiteAxesAuxTransBase into ParasiteAxesBase. #18675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ParasiteAxesAuxTransBase | ||
~~~~~~~~~~~~~~~~~~~~~~~~ | ||
The functionality of that mixin class has been moved to the base | ||
``ParasiteAxesBase`` class. Thus, ``ParasiteAxesAuxTransBase``, | ||
``ParasiteAxesAuxTrans``, and ``parasite_axes_auxtrans_class_factory`` are | ||
deprecated. | ||
|
||
In general, it is suggested to use ``HostAxes.get_aux_axes`` to create | ||
parasite axes, as this saves the need of manually appending the parasite | ||
to ``host.parasites`` and makes sure that their ``remove()`` method works | ||
properly. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
from matplotlib import cbook | ||
from mpl_toolkits.axes_grid1.parasite_axes import ( | ||
host_axes_class_factory, parasite_axes_class_factory, | ||
parasite_axes_auxtrans_class_factory, subplot_class_factory) | ||
from mpl_toolkits.axisartist.axislines import Axes | ||
|
||
|
||
ParasiteAxes = parasite_axes_class_factory(Axes) | ||
ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(ParasiteAxes) | ||
HostAxes = host_axes_class_factory(Axes) | ||
SubplotHost = subplot_class_factory(HostAxes) | ||
with cbook._suppress_matplotlib_deprecation_warning(): | ||
ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(ParasiteAxes) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
from matplotlib import cbook | ||
from mpl_toolkits.axes_grid1.parasite_axes import ( | ||
host_axes_class_factory, parasite_axes_class_factory, | ||
parasite_axes_auxtrans_class_factory, subplot_class_factory) | ||
from .axislines import Axes | ||
|
||
|
||
ParasiteAxes = parasite_axes_class_factory(Axes) | ||
ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(ParasiteAxes) | ||
HostAxes = host_axes_class_factory(Axes) | ||
SubplotHost = subplot_class_factory(HostAxes) | ||
with cbook._suppress_matplotlib_deprecation_warning(): | ||
ParasiteAxesAuxTrans = parasite_axes_auxtrans_class_factory(ParasiteAxes) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import numpy as np | ||
from matplotlib import cbook | ||
import matplotlib.pyplot as plt | ||
from matplotlib.testing.decorators import image_comparison | ||
from matplotlib.transforms import IdentityTransform | ||
|
||
from mpl_toolkits.axisartist.axislines import SubplotZero, Subplot | ||
from mpl_toolkits.axisartist import SubplotHost, ParasiteAxesAuxTrans | ||
from mpl_toolkits.axisartist import ( | ||
Axes, SubplotHost, ParasiteAxes, ParasiteAxesAuxTrans) | ||
|
||
from mpl_toolkits.axisartist import Axes | ||
import pytest | ||
|
||
|
||
@image_comparison(['SubplotZero.png'], style='default') | ||
|
@@ -59,9 +61,10 @@ def test_Axes(): | |
fig.canvas.draw() | ||
|
||
|
||
@pytest.mark.parametrize('parasite_cls', [ParasiteAxes, ParasiteAxesAuxTrans]) | ||
@image_comparison(['ParasiteAxesAuxTrans_meshplot.png'], | ||
remove_text=True, style='default', tol=0.075) | ||
def test_ParasiteAxesAuxTrans(): | ||
def test_ParasiteAxesAuxTrans(parasite_cls): | ||
# Remove this line when this test image is regenerated. | ||
plt.rcParams['pcolormesh.snap'] = False | ||
|
||
|
@@ -83,7 +86,8 @@ def test_ParasiteAxesAuxTrans(): | |
ax1 = SubplotHost(fig, 1, 3, i+1) | ||
fig.add_subplot(ax1) | ||
|
||
ax2 = ParasiteAxesAuxTrans(ax1, IdentityTransform()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the functionality of ParasiteAxesAuxTrans was fully folded into ParasiteAxes, so it should still be tested -- just as part of ParasiteAxes. I guess I could rename the test to test_parasite_auxtrans? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, I see; parametrized the test to check both classes. |
||
with cbook._suppress_matplotlib_deprecation_warning(): | ||
ax2 = parasite_cls(ax1, IdentityTransform()) | ||
ax1.parasites.append(ax2) | ||
if name.startswith('pcolor'): | ||
getattr(ax2, name)(xx, yy, data[:-1, :-1]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably add
add_parasite_axes()
in a followup PR and (soft-)deprecateget_aux_axes
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do this in another PR, as you say.