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 121fbfc

Browse filesBrowse files
authored
Remove What's new fancy example (#13685)
* Remove What's new fancy example * Use original code in New in matplotllib 0.98.4 * Adapt plot parameters to mimic original behavior
1 parent b1ae81c commit 121fbfc
Copy full SHA for 121fbfc

File tree

Expand file treeCollapse file tree

5 files changed

+82
-93
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+82
-93
lines changed

‎.flake8

Copy file name to clipboardExpand all lines: .flake8
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ per-file-ignores =
175175
examples/pyplots/text_commands.py: E231, E402
176176
examples/pyplots/text_layout.py: E231, E402
177177
examples/pyplots/whats_new_1_subplot3d.py: E402
178-
examples/pyplots/whats_new_98_4_fancy.py: E302, E402
179178
examples/pyplots/whats_new_98_4_fill_between.py: E225, E402
180179
examples/pyplots/whats_new_98_4_legend.py: E228, E402
181180
examples/pyplots/whats_new_99_axes_grid.py: E402
@@ -222,6 +221,7 @@ per-file-ignores =
222221
examples/text_labels_and_annotations/annotation_demo.py: E501
223222
examples/text_labels_and_annotations/demo_text_rotation_mode.py: E402
224223
examples/text_labels_and_annotations/custom_legends.py: E402
224+
examples/text_labels_and_annotations/fancyarrow_demo.py: E402
225225
examples/text_labels_and_annotations/font_family_rc_sgskip.py: E402
226226
examples/text_labels_and_annotations/font_file.py: E402
227227
examples/text_labels_and_annotations/legend.py: E402

‎doc/users/prev_whats_new/whats_new_0.98.4.rst

Copy file name to clipboardExpand all lines: doc/users/prev_whats_new/whats_new_0.98.4.rst
+63-12Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ submitted patches
2323
.. _legend-refactor:
2424

2525
Legend enhancements
26-
--------------------
26+
-------------------
2727

2828
Jae-Joon has rewritten the legend class, and added support for
2929
multiple columns and rows, as well as fancy box drawing. See
@@ -40,7 +40,7 @@ multiple columns and rows, as well as fancy box drawing. See
4040
.. _fancy-annotations:
4141

4242
Fancy annotations and arrows
43-
-----------------------------
43+
----------------------------
4444

4545
Jae-Joon has added lots of support to annotations for drawing fancy
4646
boxes and connectors in annotations. See
@@ -49,18 +49,66 @@ boxes and connectors in annotations. See
4949
:class:`~matplotlib.patches.ArrowStyle`, and
5050
:class:`~matplotlib.patches.ConnectionStyle`.
5151

52-
.. figure:: ../../gallery/pyplots/images/sphx_glr_whats_new_98_4_fancy_001.png
53-
:target: ../../gallery/pyplots/whats_new_98_4_fancy.html
54-
:align: center
55-
:scale: 50
52+
.. plot::
5653

57-
Whats New 98 4 Fancy
54+
import matplotlib.patches as mpatch
55+
import matplotlib.pyplot as plt
5856

59-
.. _psd-amplitude:
57+
figheight = 4
58+
fig = plt.figure(figsize=(4.5, figheight), dpi=80)
59+
fontsize = 0.2 * fig.dpi
60+
61+
def make_boxstyles(ax):
62+
styles = mpatch.BoxStyle.get_styles()
63+
64+
for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
65+
ax.text(0.5, (float(len(styles)) - 0.5 - i)/len(styles), stylename,
66+
ha="center",
67+
size=fontsize,
68+
transform=ax.transAxes,
69+
bbox=dict(boxstyle=stylename, fc="w", ec="k"))
70+
71+
def make_arrowstyles(ax):
72+
styles = mpatch.ArrowStyle.get_styles()
73+
74+
ax.set_xlim(0, 4)
75+
ax.set_ylim(0, figheight*2)
76+
77+
for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
78+
y = (float(len(styles)) - 0.25 - i) # /figheight
79+
p = mpatch.Circle((3.2, y), 0.2, fc="w")
80+
ax.add_patch(p)
81+
82+
ax.annotate(stylename, (3.2, y),
83+
(2., y),
84+
# xycoords="figure fraction", textcoords="figure fraction",
85+
ha="right", va="center",
86+
size=fontsize,
87+
arrowprops=dict(arrowstyle=stylename,
88+
patchB=p,
89+
shrinkA=5,
90+
shrinkB=5,
91+
fc="w", ec="k",
92+
connectionstyle="arc3,rad=-0.05",
93+
),
94+
bbox=dict(boxstyle="square", fc="w"))
95+
96+
ax.xaxis.set_visible(False)
97+
ax.yaxis.set_visible(False)
98+
99+
100+
ax1 = fig.add_subplot(121, frameon=False, xticks=[], yticks=[])
101+
make_boxstyles(ax1)
102+
103+
ax2 = fig.add_subplot(122, frameon=False, xticks=[], yticks=[])
104+
make_arrowstyles(ax2)
105+
106+
107+
plt.show()
60108

61109

62110
Native OS X backend
63-
--------------------
111+
-------------------
64112

65113
Michiel de Hoon has provided a native Mac OSX backend that is almost
66114
completely implemented in C. The backend can therefore use Quartz
@@ -74,8 +122,11 @@ matplotlibrc file, or run your script with::
74122

75123
> python myfile.py -dmacosx
76124

125+
126+
.. _psd-amplitude:
127+
77128
psd amplitude scaling
78-
-------------------------
129+
---------------------
79130

80131
Ryan May did a lot of work to rationalize the amplitude scaling of
81132
:func:`~matplotlib.pyplot.psd` and friends. See
@@ -86,7 +137,7 @@ compatibility and increase scaling options.
86137
.. _fill-between:
87138

88139
Fill between
89-
------------------
140+
------------
90141

91142
Added a :func:`~matplotlib.pyplot.fill_between` function to make it
92143
easier to do shaded region plots in the presence of masked data. You
@@ -102,7 +153,7 @@ where you want to do the filling.
102153
Whats New 98 4 Fill Between
103154

104155
Lots more
105-
-----------
156+
---------
106157

107158
Here are the 0.98.4 notes from the CHANGELOG::
108159

‎examples/pyplots/whats_new_98_4_fancy.py

Copy file name to clipboardExpand all lines: examples/pyplots/whats_new_98_4_fancy.py
-80Lines changed: 0 additions & 80 deletions
This file was deleted.

‎examples/shapes_and_collections/fancybox_demo.py

Copy file name to clipboardExpand all lines: examples/shapes_and_collections/fancybox_demo.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,3 +210,5 @@ def test_all():
210210
matplotlib.patches.BoxStyle
211211
matplotlib.patches.BoxStyle.get_styles
212212
matplotlib.transforms.Bbox
213+
matplotlib.figure.Figure.text
214+
matplotlib.axes.Axes.text

‎examples/text_labels_and_annotations/fancyarrow_demo.py

Copy file name to clipboardExpand all lines: examples/text_labels_and_annotations/fancyarrow_demo.py
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,19 @@ def to_texstring(s):
5252
ax.yaxis.set_visible(False)
5353

5454
plt.show()
55+
56+
#############################################################################
57+
#
58+
# ------------
59+
#
60+
# References
61+
# """"""""""
62+
#
63+
# The use of the following functions, methods, classes and modules is shown
64+
# in this example:
65+
66+
import matplotlib
67+
matplotlib.patches
68+
matplotlib.patches.ArrowStyle
69+
matplotlib.patches.ArrowStyle.get_styles
70+
matplotlib.axes.Axes.annotate

0 commit comments

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