Skip to content

Commit 7131207

Browse files
committed
Fix the figure size in style sheet reference
It's better to override absolute sizes in the style sheet. Otherwise, larger figure images are scaled down due to the limited available width in the html theme. If not, we still don't get a size relation, but we also have different magnifications due to the image scaling. Notes: - The width (7.4 -> 740px, assuming 100 dpi) is chosen to fit in the HTML without scaling. - The size is chosen to approximately keep the aspect ratio as before. - The images are now significantly smaller than previously (all former images were downscaled). We'll have to verify that the images still look good given a lot of information and not much space. If not, we need to add a factor. - All themes use figure.dpi=100, except "classic", which uses 80. Not correcting for that is intentional. IMHO "classic" should come out smaller to highlight the change in dpi.
1 parent b371463 commit 7131207

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

examples/style_sheets/style_sheets_reference.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,8 @@ def plot_figure(style_label=""):
109109
# across the different figures.
110110
prng = np.random.RandomState(96917002)
111111

112-
# Tweak the figure size to be better suited for a row of numerous plots:
113-
# double the width and halve the height. NB: use relative changes because
114-
# some styles may have a figure size different from the default one.
115-
(fig_width, fig_height) = plt.rcParams['figure.figsize']
116-
fig_size = [fig_width * 2, fig_height / 1.75]
117-
118112
fig, axs = plt.subplots(ncols=6, nrows=1, num=style_label,
119-
figsize=fig_size, constrained_layout=True)
113+
figsize=(7.4, 1.35), constrained_layout=True)
120114

121115
# make a suptitle, in the same style for all subfigures,
122116
# except those with dark backgrounds, which get a lighter

0 commit comments

Comments
 (0)