Add a single setting to scale all font sizes
See original GitHub issueThis was originally proposed for vegalite and altair in https://github.com/vega/vega-lite/issues/1714 and https://github.com/vega/vega-lite/issues/6988 and reccomended by @domoritz to open an issue here instead.
Currently, it is cumbersome to scale ip all font sizes since it involves setting many different parameters individually, for example:
spec.width = 800;
spec.height = 500;
spec.config.axisY.titleFontSize = 14;
spec.config.axisX.titleFontSize = 14;
spec.config.axisY.labelFontSize = 16;
spec.config.axisX.labelFontSize = 16;
spec.title.fontSize = 20;
spec.encoding.color.legend.titleFontSize = 15;
spec.encoding.color.legend.labelFontSize = 15;
# facet headers fontsize also needs to be set individually now
Providing a shortcut for scaling all these parameters would be highly convenient from a usability perspective, particularly as a setting that applies to all plots (similar to setting a default theme), but also (less importantly) for individual plots. For what it’s worth, this setting is available in other high level plotting libraries such as seaborn (sns.set_theme(font_scale=1.5)
) and ggplot (theme_set(theme_grey(base_size = 18))
).
I believe this feature is especially important since the the default font sizes in Vega are quite small. If possible, it would also be great to also consider an increase of the default fontsizes to ~1.2 times the current size, but I understand if this default is no longer amendable to change from suggestions.
I believe all the defaults are listed here for future reference https://github.com/vega/vega/blob/main/packages/vega-parser/src/config.js#L82-L129=
Please:
- Check for duplicate issues. Please file separate requests as separate issues on GitHub.
- Clearly describe the goal of the feature request. Why is it needed?
- Describe an envisioned solution. What do you want the new behavior to be?
- If applicable, share mockup images or links to examples illustrating the desired output.
- If applicable, share JSON spec designs for how the behavior would be made available in Vega.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top GitHub Comments
FYI, for
you can just do
So it’s a bit less tedious.
In Seaborn’s set_theme function, you can change the scaling of all plot elements (so text, axes, markers, etc) via the
plotting_context
param, and control the size of just the text with thefont_scale
param. For ggplot I am unsure if there is an option to control the size of all plot elements, butbase_size
can be used to scale all text as above.