Skip to content

Commit 9aa28df

Browse files
committed
Relpace the sinosoidal lines in the style sheet reference
with less overlapping lines to make the color cycle more obvious.
1 parent 3c00cc2 commit 9aa28df

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

examples/style_sheets/style_sheets_reference.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,19 @@ def plot_scatter(ax, prng, nb_samples=100):
2626
return ax
2727

2828

29-
def plot_colored_sinusoidal_lines(ax):
30-
"""Plot sinusoidal lines with colors following the style color cycle."""
31-
L = 2 * np.pi
32-
x = np.linspace(0, L)
29+
def plot_colored_lines(ax):
30+
"""Plot lines with colors following the style color cycle."""
31+
t = np.linspace(-10, 10, 100)
32+
33+
def sigmoid(t, t0):
34+
return 1 / (1 + np.exp(-(t - t0)))
35+
3336
nb_colors = len(plt.rcParams['axes.prop_cycle'])
34-
shift = np.linspace(0, L, nb_colors, endpoint=False)
35-
for s in shift:
36-
ax.plot(x, np.sin(x + s), '-')
37-
ax.set_xlim([x[0], x[-1]])
37+
shifts = np.linspace(-5, 5, nb_colors)
38+
amplitudes = np.linspace(1, 1.5, nb_colors)
39+
for t0, a in zip(shifts, amplitudes):
40+
ax.plot(t, a * sigmoid(t, t0), '-')
41+
ax.set_xlim(-10, 10)
3842
return ax
3943

4044

@@ -118,7 +122,7 @@ def plot_figure(style_label=""):
118122
plot_image_and_patch(axs[1], prng)
119123
plot_bar_graphs(axs[2], prng)
120124
plot_colored_circles(axs[3], prng)
121-
plot_colored_sinusoidal_lines(axs[4])
125+
plot_colored_lines(axs[4])
122126
plot_histograms(axs[5], prng)
123127

124128
fig.tight_layout()

0 commit comments

Comments
 (0)