Setting themes
by: Kevin Broløs
(Feyn version 3.4.0 or newer)
In some situations, such as if you're running in a dark mode editor, or if you're looking to publish your results in a journal, you might want to use a different theme.
Example
import feyn
from feyn import Theme
ql = feyn.QLattice()
models = ql.sample_models(['Hello'], 'World')
We have four themes available: Default, Dark, Monochrome and Monochrome Dark
Theme.set_theme('default')
models[0]
These themes also apply to our plots and graphs. We've made a comparison to the stylesheet reference in matplotlib down below, and also showcase some colormaps that are registered with matplotlib.
Theme.set_theme('dark')
models[0]
These themes also apply to our plots and graphs. We've made a comparison to the stylesheet reference in matplotlib down below, and also showcase some colormaps that are registered with matplotlib.



Theme.set_theme('mono')
models[0]
These themes also apply to our plots and graphs. We've made a comparison to the stylesheet reference in matplotlib down below, and also showcase some colormaps that are registered with matplotlib.
Theme.set_theme('mono_dark')
models[0]
These themes also apply to our plots and graphs. We've made a comparison to the stylesheet reference in matplotlib down below, and also showcase some colormaps that are registered with matplotlib.



Full list of feyn colormaps: feyn
, feyn-diverging
, feyn-partial
, feyn-primary
, feyn-highlight
, feyn-secondary
, feyn-accent
, feyn-signal
.
This should help make our graphs a little easier on the eyes in different editors.
Flipping colormaps
Some colormaps, notably feyn-diverging
, are used heavily for classification plots where color coding can carry important meaning.
For a binary outcome, sometimes 0
is a good outcome and 1
is bad, and other times, it's the opposite. The default ordering is 0
gets the "danger" hues and 1
gets the "safer" hues.
There's a helper function on Theme
to flip the order of this colormap, so you can easily control the positive and negative end of the color scale without having to supply a new colormap for each plot you do throughout.
As a shorthand for the diverging colormap:
Theme.flip_diverging_cmap()
which is the colormap used by default in plot_response_2d
and plot_probability_scores
.
or as a general function that works for all of the feyn colormaps, should you want that:
Theme.flip_cmap("feyn-diverging")
Each time you call the function, the colormap is reversed in order, so calling it twice will revert it to normal.