After we saw four examples in the first part, let's look at four more and learn more about how people package Altair themes.
Based on the altair-latimes package, we have altair-reveal. In this package, we can find the Reveal theme for Altair. An interesting detail in this theme is the empty space available at the bottom of each chart (bottom padding) to accommodate manually added sources and credits. We can see this detail, as well as several examples, from this notebook directly on GitHub.
For the Sun Sentinel theme, there is sunsentinel_theme. This theme is based on husky_theme, and for us to use it, we have to follow the steps mentioned in the first part (it is not a pip
installable Python package).
Based on spaCy branding, we can find two themes in the spacy-altair-theme package. One of them is a monospaced version of the available base theme. In addition to a function for each of the themes (each function contains some constants and returns a dictionary with the configuration for the respective theme), we can also find three importable lists for the three types of defined color palettes. To use these themes, we just need to alt.themes.enable()
the desired one, as these are alt.themes.register()
ed when we import the package. As a final note, some color variants were chosen from spaCy's style guide because of contrast (like dark blue and dark green instead of blue and green, respectively).
In the case of the pcolor package (bootstrapped from the nbdev template), we can find an Altair (and seaborn) theme for personal use. This package contains color constants and various utilities, in addition to the typical function for the theme (pulsifi_theme
). It also provides a utility function called setup_altair()
that wraps up theme registration and activation.
Finally, if you have any questions or suggestions, feel free to leave a comment below!
Top comments (0)