Skip to content

Commit 98d4bc4

Browse files
Make What's New example simpler and more informative
1 parent e94a777 commit 98d4bc4

File tree

1 file changed

+8
-32
lines changed

1 file changed

+8
-32
lines changed

doc/users/next_whats_new/box_arrow_size_controls.rst

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,16 @@ By using negative angles (or corresponding reflex angles) for *head_angle*, arro
99
with 'backwards' heads may be created.
1010

1111
.. plot::
12-
:include-source: false
13-
:alt: A plot containing two arrow-shaped text boxes. One arrow has a pentagonal 'road-sign' shape, and the other an inverted arrow head on each end.
12+
:include-source: true
13+
:alt: Six arrow-shaped text boxes, all containing the text "Arrow". The top left arrow has a shorter head than default, while the top right arrow a longer head. The centre left double arrow has a "road-sign" shape (head as wide as the arrow tail), while the centre right arrow has a "backwards" head. The bottom left arrow has two heads which are larger than default, and the bottom right arrow has a head narrower than its tail.
1414

15-
import numpy as np
1615
import matplotlib.pyplot as plt
1716

18-
# Data for plotting; here, an intensity distribution for Fraunhofer diffraction
19-
# from 7 thin slits
20-
x_data = np.linspace(-3 * np.pi, 3 * np.pi, num=1000)
21-
I_data = (np.sin(x_data * 3.5) / np.sin(x_data / 2)) ** 2
22-
23-
# Generate plot
24-
25-
fig, ax = plt.subplots()
26-
plt.plot(x_data, I_data)
27-
28-
plt.xlim(-3 * np.pi, 3 * np.pi)
29-
plt.ylim(0, 50)
30-
31-
#
32-
# Annotate with boxed text in arrows
33-
#
34-
35-
# head_width=1 gives 'road-sign' shape
36-
t1 = ax.text(-1, 35, "Primary maximum",
37-
ha="right", va="center", rotation=30, size=10,
38-
bbox=dict(boxstyle="rarrow,pad=0.3,head_width=1,head_angle=60",
39-
fc="lightblue", ec="steelblue", lw=2))
40-
41-
# Negative head_angle gives reversed arrow heads
42-
t2 = ax.text(np.pi, 30, "Lower intensity",
43-
ha="center", va="center", rotation=0, size=10,
44-
bbox=dict(boxstyle="darrow,pad=0.3,head_width=2,head_angle=-80",
45-
fc="lightblue", ec="steelblue", lw=2))
46-
17+
plt.text(0.2, 0.8, "Arrow", ha='center', size=16, bbox=dict(boxstyle="larrow, pad=0.3, head_angle=150"))
18+
plt.text(0.7, 0.8, "Arrow", ha='center', size=16, bbox=dict(boxstyle="rarrow, pad=0.3, head_angle=30"))
19+
plt.text(0.2, 0.2, "Arrow", ha='center', size=16, bbox=dict(boxstyle="darrow, pad=0.3, head_width=3"))
20+
plt.text(0.7, 0.2, "Arrow", ha='center', size=16, bbox=dict(boxstyle="larrow, pad=0.3, head_width=0.5"))
21+
plt.text(0.2, 0.5, "Arrow", ha='center', size=16, bbox=dict(boxstyle="darrow, pad=0.3, head_width=1, head_angle=60"))
22+
plt.text(0.7, 0.5, "Arrow", ha='center', size=16, bbox=dict(boxstyle="rarrow, pad=0.3, head_width=2, head_angle=-90"))
4723

4824
plt.show()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy