Skip to content

Commit ee4f516

Browse files
committed
DOC: fix suptitle
1 parent 412c1da commit ee4f516

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/style_sheets/style_sheets_reference.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import numpy as np
1313
import matplotlib.pyplot as plt
14+
import matplotlib.colors as mcolors
1415

1516
# Fixing random state for reproducibility
1617
np.random.seed(19680801)
@@ -112,7 +113,13 @@ def plot_figure(axs, style_label=""):
112113
plot_colored_circles(axs[3], prng)
113114
plot_colored_sinusoidal_lines(axs[4])
114115
plot_histograms(axs[5], prng)
115-
116+
col = np.array([19, 6, 84])/256
117+
back = mcolors.rgb_to_hsv(
118+
mcolors.to_rgb(plt.rcParams['figure.facecolor']))[2]
119+
if back < 0.5:
120+
col = [0.8, 0.8, 1]
121+
axs[0].figure.suptitle(style_label, x=0.03, fontsize=12,
122+
ha='left', color=col)
116123

117124
if __name__ == "__main__":
118125

@@ -133,5 +140,4 @@ def plot_figure(axs, style_label=""):
133140
with plt.style.context(style_label):
134141
ax = sfig.subplots(1, 6)
135142
plot_figure(ax, style_label=style_label)
136-
sfig.suptitle(style_label)
137143
plt.show()

0 commit comments

Comments
 (0)