Website Theme

The nowcast.figures.website_theme module provides the definition of colours and fonts that figure modules must use in order to ensure consistency from one to the next, and with the salishsea.eos.ubc.ca site NEMO results section styling.

The module contains:

SITE_BACKGROUND_COLOUR

SITE_BACKGROUND_COLOUR is the hex code for the salishsea.eos.ubc.ca/ pages background colour, from the https://bootswatch.com/superhero/ theme. It is defined explicitly to make it obvious in the website_theme module. It is used in the COLOURS dictionary as COLOURS['figure']['facecolor'] so that you can apply it to Figure objects by creating them with calls like:

fig = plt.figure(
    figsize=figsize, facecolor=theme.COLOURS['figure']['facecolor'])

COLOURS

Colours of various figure elements; the dict key(s) should be descriptive enough to identify the element to which the colour applies. Use them wherever you need to specify the colour of an element of a figure; e.g.:

ax.set_xlabel(
    'Distance along thalweg [km]', color=theme.COLOURS['text']['axis'],
    fontproperties=theme.FONTS['axis'])

FONTS

Font properties of various figure text elements; the top level dict keys should be descriptive enough to identify the element to which the font properties apply. Use them whereever you need to specify the font properties of an element of a figure; e.g.:

cbar.set_label(
    label,
    fontproperties=theme.FONTS['axis'],
    color=theme.COLOURS['text']['axis'])

set_axis_colors()

The need to set the colours of axes labels, ticks, and spines is common enough, and requires enough matplotlib.axes.Axes method calls that we have created a convenience function to do it. Typical use is in a website figure module axes labeling function:

theme.set_axis_colors(ax)