Plotting§
It is extremely easy to plot xarray data objects, for example simply by calling xarray.DataArray.plot()
. Xarray wraps the matplotlib library and makes its functions available as DataArray
and Dataset
methods.
Info
Please consult the "Plotting" section of xarray's User Guide to learn about all of its plotting capabilities.
Interactive plots
It is also very easy to produce interactive plots of xarray data objects with hvPlot.
Though xarray's plotting capabilities can be used directly, ozzy does some extra aesthetic tinkering when the plotting submodule, ozzy.plot
, is loaded. This submodule activates the following defaults:
Defaults | |
---|---|
Curve color scheme | 'tol.muted' |
Sequential colormap | 'cmc.lipari' |
Diverging colormap | 'cmc.vik' |
Font | Noto Serif |
Color maps and schemes§
Ozzy aims to make scientific plots as accessible and as scientific as possible. In accordance with this principle, the default color maps and color schemes in ozzy.plot
are perceptually uniform and readable by people with color-blindness. However, several color options that fulfill these criteria are available, most of which were developed by Fabio Crameri and Paul Tol.
Acknowledging Fabio Crameri's "Scientific colour maps"
Please note that color maps developed by Fabio Crameri, which includes the default color maps vik
(diverging) and lipari
(sequential), should be acknowledged if used in a published image, for example with:
The Scientific colour map lipari1 is used in this study to prevent visual distortion of the data and exclusion of readers with colour-vision deficiencies2.
A sample of all available color maps and color schemes in ozzy.plot
can be produced with:
import ozzy.plot as oplt
oplt.show_cmaps()
Fonts§
Ozzy's plotting submodule also bundles a few different open-source fonts:
Alternatively, LaTeX font can be used for all text and labels with:
import ozzy.plot as oplt
import matplotlib.pyplot as plt
plt.rcParams["text.usetex"] = True
To see all available fonts on the system, use:
import ozzy.plot as oplt
oplt.show_fonts(samples=True)
See also§
- The seaborn library (used by ozzy to set the figure context)
- matplotlib
-
F. Crameri, "Scientific colour maps". Zenodo, Oct. 05, 2023. doi: 10.5281/zenodo.8409685. ↩
-
F. Crameri, G.E. Shephard, and P.J. Heron, "The misuse of colour in science communication". Nat. Commun. 11, 5444 (2020). doi: 10.1038/s41467-020-19160-7. ↩