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 efafd31

Browse filesBrowse files
committed
Avoid using private APIs in examples.
Most fixes are trivial, except the removal of the call to _update_patch_transform() in widgets/menu.py: this is OK because calling Rectangle.draw() will itself call _update_patch_transform() via get_patch_transform().
1 parent 4769f7b commit efafd31
Copy full SHA for efafd31

File tree

Expand file treeCollapse file tree

4 files changed

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

4 files changed

+6
-7
lines changed

‎examples/specialty_plots/radar_chart.py

Copy file name to clipboardExpand all lines: examples/specialty_plots/radar_chart.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def _gen_axes_patch(self):
9090

9191
def _gen_axes_spines(self):
9292
if frame == 'circle':
93-
return PolarAxes._gen_axes_spines(self)
93+
return super()._gen_axes_spines()
9494
# The following is a hack to get the spines (i.e. the axes frame)
9595
# to draw correctly for a polygon frame.
9696

‎examples/text_labels_and_annotations/demo_text_path.py

Copy file name to clipboardExpand all lines: examples/text_labels_and_annotations/demo_text_path.py
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,7 @@ def draw(self, renderer=None):
6666

6767
ax = plt.subplot(211)
6868

69-
from matplotlib._png import read_png
70-
fn = get_sample_data("grace_hopper.png", asfileobj=False)
71-
arr = read_png(fn)
69+
arr = plt.imread(get_sample_data("grace_hopper.png"))
7270

7371
text_path = TextPath((0, 0), "!?", size=150)
7472
p = PathClippedImagePatch(text_path, arr, ec="k",

‎examples/text_labels_and_annotations/rainbow_text.py

Copy file name to clipboardExpand all lines: examples/text_labels_and_annotations/rainbow_text.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ def rainbow_text(x, y, strings, colors, ax=None, **kw):
4848
text = ax.text(x, y, s + " ", color=c, transform=t, **kw)
4949
text.draw(canvas.get_renderer())
5050
ex = text.get_window_extent()
51-
t = transforms.offset_copy(text._transform, x=ex.width, units='dots')
51+
t = transforms.offset_copy(
52+
text.get_transform(), x=ex.width, units='dots')
5253

5354
# vertical version
5455
for s, c in zip(strings, colors):
5556
text = ax.text(x, y, s + " ", color=c, transform=t,
5657
rotation=90, va='bottom', ha='center', **kw)
5758
text.draw(canvas.get_renderer())
5859
ex = text.get_window_extent()
59-
t = transforms.offset_copy(text._transform, y=ex.height, units='dots')
60+
t = transforms.offset_copy(
61+
text.get_transform(), y=ex.height, units='dots')
6062

6163

6264
rainbow_text(0, 0, "all unicorns poop rainbows ! ! !".split(),

‎examples/widgets/menu.py

Copy file name to clipboardExpand all lines: examples/widgets/menu.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ def set_extent(self, x, y, w, h):
8989
self.label.ox = x + self.padx
9090
self.label.oy = y - self.depth + self.pady/2.
9191

92-
self.rect._update_patch_transform()
9392
self.hover = False
9493

9594
def draw(self, renderer):

0 commit comments

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