Use different plot themes

Shows how to customize plot styles, using seaborn , matplotlib or publib

Examples

To change it in your user script, set the keys of the "plot" bloc in radis.config :

import radis
radis.config["plot"]["plotlib"] = "seaborn"
radis.config["plot"]["context"] = "paper"
radis.config["plot"]["style"] = "darkgrid"

To change your default settings, edit the ~/radis.json Configuration file

See Also

set_style(), fix_style(),

  • matplotlib, , default
  • seaborn, paper, darkgrid
  • publib, paper, origin
  • seaborn, poster, darkgrid
  • publib, poster, origin
Calculating Equilibrium Spectrum
Physical Conditions
----------------------------------------
   Tgas                 700 K
   Trot                 700 K
   Tvib                 700 K
   isotope              1,2,3
   mole_fraction        0.1
   molecule             CO
   overpopulation       None
   path_length          1 cm
   pressure_mbar        1013.25 mbar
   rot_distribution     boltzmann
   self_absorption      True
   state                X
   vib_distribution     boltzmann
   wavenum_max          2300.0000 cm-1
   wavenum_min          1900.0000 cm-1
Computation Parameters
----------------------------------------
   Tref                 296 K
   add_at_used
   broadening_method    voigt
   cutoff               1e-27 cm-1/(#.cm-2)
   dbformat             hitran
   dbpath               /home/docs/.radisdb/hitran/CO.hdf5
   folding_thresh       1e-06
   include_neighbouring_lines  True
   memory_mapping_engine  auto
   neighbour_lines      0 cm-1
   optimization         simple
   parfuncfmt           hapi
   parsum_mode          full summation
   pseudo_continuum_threshold  0
   sparse_ldm           auto
   truncation           50 cm-1
   waveunit             cm-1
   wstep                0.01 cm-1
   zero_padding         -1
----------------------------------------
0.08s - Spectrum calculated

import matplotlib.pyplot as plt

import radis

plt.close("all")
s = radis.test_spectrum()

for plotlib, context, style in [
    ("matplotlib", "", "default"),
    ("seaborn", "paper", "darkgrid"),
    ("publib", "paper", "origin"),
    ("seaborn", "poster", "darkgrid"),
    ("publib", "poster", "origin"),
]:
    radis.config["plot"]["plotlib"] = plotlib
    radis.config["plot"]["context"] = context
    radis.config["plot"]["style"] = style
    s.plot()
    plt.title(", ".join(f"{v}" for v in radis.config["plot"].values()))
    plt.tight_layout()

Total running time of the script: ( 0 minutes 3.853 seconds)