Skip to content

Commit 9247b9d

Browse files
committed
Improve curved quiver example styling
1 parent f661dd6 commit 9247b9d

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

docs/examples/plot_types/01_curved_quiver.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,25 @@
4646
arrowsize=1.4,
4747
density=20,
4848
grains=20,
49-
cmap="sciviscoloreven",
49+
cmap="viko",
5050
)
51+
m.lines.set_clim(0.0, 1.0)
5152
values = m.lines.get_array()
5253
if values is not None and len(values) > 0:
53-
colors = m.lines.get_cmap()(m.lines.norm(values))
54-
alpha = (values - values.min()) / (values.max() - values.min() + 1e-12)
55-
colors[:, -1] = 0.15 + 0.85 * alpha
54+
normed = np.clip(m.lines.norm(values), 0.05, 0.95)
55+
colors = m.lines.get_cmap()(normed)
56+
colors[:, -1] = 0.15 + 0.85 * normed
5657
m.lines.set_color(colors)
5758
m.arrows.set_alpha(0.6)
5859
theta = np.linspace(0, 2 * np.pi, 200)
59-
ax.plot(a * np.cos(theta), a * np.sin(theta), color="black", lw=2)
60+
facecolor = ax.get_facecolor()
61+
ax.fill(
62+
a * np.cos(theta),
63+
a * np.sin(theta),
64+
color=facecolor,
65+
zorder=5,
66+
)
67+
ax.plot(a * np.cos(theta), a * np.sin(theta), color="black", lw=2, zorder=6)
6068
ax.format(
6169
title="Flow around a cylinder",
6270
xlabel="x",
@@ -66,3 +74,4 @@
6674
fig.colorbar(m.lines, ax=ax, label="Speed")
6775

6876
fig.show()
77+
uplt.show(block=1)

0 commit comments

Comments
 (0)