Skip to content

Avoid private API in some examples. #13202

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

Merged
merged 1 commit into from
Jan 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions examples/axes_grid1/demo_axes_grid2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ def get_demo_image():
return z, (-3, 4, -4, 3)


def add_inner_title(ax, title, loc, size=None, **kwargs):
def add_inner_title(ax, title, loc, **kwargs):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I removed size here because it was unused and didn't want to leave it cluttering up the example.

from matplotlib.offsetbox import AnchoredText
from matplotlib.patheffects import withStroke
if size is None:
size = dict(size=plt.rcParams['legend.fontsize'])
at = AnchoredText(title, loc=loc, prop=size,
prop = dict(path_effects=[withStroke(foreground='w', linewidth=3)],
size=plt.rcParams['legend.fontsize'])
at = AnchoredText(title, loc=loc, prop=prop,
pad=0., borderpad=0.5,
frameon=False, **kwargs)
ax.add_artist(at)
at.txt._text.set_path_effects([withStroke(foreground="w", linewidth=3)])
return at


Expand Down
10 changes: 5 additions & 5 deletions examples/axisartist/demo_curvelinear_grid2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from mpl_toolkits.axisartist.grid_helper_curvelinear import \
GridHelperCurveLinear
from mpl_toolkits.axisartist.grid_finder import MaxNLocator
from mpl_toolkits.axisartist.axislines import Subplot

import mpl_toolkits.axisartist.angle_helper as angle_helper
Expand Down Expand Up @@ -44,7 +45,10 @@ def inv_tr(x, y):
)

grid_helper = GridHelperCurveLinear((tr, inv_tr),
extreme_finder=extreme_finder)
extreme_finder=extreme_finder,
# better tick density
grid_locator1=MaxNLocator(nbins=6),
grid_locator2=MaxNLocator(nbins=6))

ax1 = Subplot(fig, 111, grid_helper=grid_helper)
# ax1 will have a ticks and gridlines defined by the given
Expand All @@ -59,10 +63,6 @@ def inv_tr(x, y):
interpolation="nearest",
origin="lower")

# tick density
grid_helper.grid_finder.grid_locator1._nbins = 6
grid_helper.grid_finder.grid_locator2._nbins = 6


if __name__ == "__main__":
fig = plt.figure(figsize=(7, 4))
Expand Down
7 changes: 3 additions & 4 deletions examples/axisartist/demo_floating_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ def setup_axes1(fig, rect):
tr = Affine2D().scale(2, 1).rotate_deg(30)

grid_helper = floating_axes.GridHelperCurveLinear(
tr, extremes=(-0.5, 3.5, 0, 4))
tr, extremes=(-0.5, 3.5, 0, 4),
grid_locator1=MaxNLocator(nbins=4),
grid_locator2=MaxNLocator(nbins=4))

ax1 = floating_axes.FloatingSubplot(fig, rect, grid_helper=grid_helper)
fig.add_subplot(ax1)

aux_ax = ax1.get_aux_axes(tr)

grid_helper.grid_finder.grid_locator1._nbins = 4
grid_helper.grid_finder.grid_locator2._nbins = 4

return ax1, aux_ax


Expand Down
2 changes: 1 addition & 1 deletion examples/axisartist/demo_parasite_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

par2.set_ylabel("Velocity")
offset = (60, 0)
new_axisline = par2._grid_helper.new_fixed_axis
new_axisline = par2.get_grid_helper().new_fixed_axis
par2.axis["right2"] = new_axisline(loc="right", axes=par2, offset=offset)

fig.add_axes(host)
Expand Down