Skip to content

Commit 99af9e3

Browse files
authored
Merge pull request #13202 from QuLogic/no-private-api
Avoid private API in some examples.
2 parents 0f4e348 + 18b110e commit 99af9e3

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

examples/axes_grid1/demo_axes_grid2.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ def get_demo_image():
2020
return z, (-3, 4, -4, 3)
2121

2222

23-
def add_inner_title(ax, title, loc, size=None, **kwargs):
23+
def add_inner_title(ax, title, loc, **kwargs):
2424
from matplotlib.offsetbox import AnchoredText
2525
from matplotlib.patheffects import withStroke
26-
if size is None:
27-
size = dict(size=plt.rcParams['legend.fontsize'])
28-
at = AnchoredText(title, loc=loc, prop=size,
26+
prop = dict(path_effects=[withStroke(foreground='w', linewidth=3)],
27+
size=plt.rcParams['legend.fontsize'])
28+
at = AnchoredText(title, loc=loc, prop=prop,
2929
pad=0., borderpad=0.5,
3030
frameon=False, **kwargs)
3131
ax.add_artist(at)
32-
at.txt._text.set_path_effects([withStroke(foreground="w", linewidth=3)])
3332
return at
3433

3534

examples/axisartist/demo_curvelinear_grid2.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from mpl_toolkits.axisartist.grid_helper_curvelinear import \
1717
GridHelperCurveLinear
18+
from mpl_toolkits.axisartist.grid_finder import MaxNLocator
1819
from mpl_toolkits.axisartist.axislines import Subplot
1920

2021
import mpl_toolkits.axisartist.angle_helper as angle_helper
@@ -44,7 +45,10 @@ def inv_tr(x, y):
4445
)
4546

4647
grid_helper = GridHelperCurveLinear((tr, inv_tr),
47-
extreme_finder=extreme_finder)
48+
extreme_finder=extreme_finder,
49+
# better tick density
50+
grid_locator1=MaxNLocator(nbins=6),
51+
grid_locator2=MaxNLocator(nbins=6))
4852

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

62-
# tick density
63-
grid_helper.grid_finder.grid_locator1._nbins = 6
64-
grid_helper.grid_finder.grid_locator2._nbins = 6
65-
6666

6767
if __name__ == "__main__":
6868
fig = plt.figure(figsize=(7, 4))

examples/axisartist/demo_floating_axes.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ def setup_axes1(fig, rect):
3232
tr = Affine2D().scale(2, 1).rotate_deg(30)
3333

3434
grid_helper = floating_axes.GridHelperCurveLinear(
35-
tr, extremes=(-0.5, 3.5, 0, 4))
35+
tr, extremes=(-0.5, 3.5, 0, 4),
36+
grid_locator1=MaxNLocator(nbins=4),
37+
grid_locator2=MaxNLocator(nbins=4))
3638

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

4042
aux_ax = ax1.get_aux_axes(tr)
4143

42-
grid_helper.grid_finder.grid_locator1._nbins = 4
43-
grid_helper.grid_finder.grid_locator2._nbins = 4
44-
4544
return ax1, aux_ax
4645

4746

examples/axisartist/demo_parasite_axes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
par2.set_ylabel("Velocity")
4343
offset = (60, 0)
44-
new_axisline = par2._grid_helper.new_fixed_axis
44+
new_axisline = par2.get_grid_helper().new_fixed_axis
4545
par2.axis["right2"] = new_axisline(loc="right", axes=par2, offset=offset)
4646

4747
fig.add_axes(host)

0 commit comments

Comments
 (0)