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 5aa407a

Browse filesBrowse files
committed
Remove unnecessary uses of transFigure from examples.
- In fig_x, fig.add_artist will adjust the artist's transform to fig.transFigure if it's not set yet. - In fancybox_demo, fig.text already defaults to using fig.transFigure. ... plus minor docstring edits.
1 parent 49decb4 commit 5aa407a
Copy full SHA for 5aa407a

File tree

Expand file treeCollapse file tree

2 files changed

+11
-15
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+11
-15
lines changed

‎examples/pyplots/fig_x.py

Copy file name to clipboardExpand all lines: examples/pyplots/fig_x.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
66
Adding lines to a figure without any axes.
77
"""
8+
89
import matplotlib.pyplot as plt
910
import matplotlib.lines as lines
1011

1112

1213
fig = plt.figure()
13-
l1 = lines.Line2D([0, 1], [0, 1], transform=fig.transFigure, figure=fig)
14-
l2 = lines.Line2D([0, 1], [1, 0], transform=fig.transFigure, figure=fig)
15-
fig.lines.extend([l1, l2])
16-
14+
fig.add_artist(lines.Line2D([0, 1], [0, 1]))
15+
fig.add_artist(lines.Line2D([0, 1], [1, 0]))
1716
plt.show()
1817

1918
#############################################################################

‎examples/shapes_and_collections/fancybox_demo.py

Copy file name to clipboardExpand all lines: examples/shapes_and_collections/fancybox_demo.py
+8-11Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
"""
2-
=============
3-
Fancybox Demo
4-
=============
2+
===================
3+
Drawing fancy boxes
4+
===================
55
6-
Plotting fancy boxes with Matplotlib.
7-
8-
The following examples show how to plot boxes with different
9-
visual properties.
6+
The following examples show how to plot boxes with different visual properties.
107
"""
8+
119
import matplotlib.pyplot as plt
1210
import matplotlib.transforms as mtransforms
1311
import matplotlib.patches as mpatch
@@ -25,10 +23,9 @@
2523

2624
for i, stylename in enumerate(sorted(styles)):
2725
fig.text(0.5, (spacing * (len(styles) - i) - 0.5) / figheight, stylename,
28-
ha="center",
29-
size=fontsize,
30-
transform=fig.transFigure,
31-
bbox=dict(boxstyle=stylename, fc="w", ec="k"))
26+
ha="center",
27+
size=fontsize,
28+
bbox=dict(boxstyle=stylename, fc="w", ec="k"))
3229

3330
plt.show()
3431

0 commit comments

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