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

Out:

Using cache file: /home/docs/.astropy/cache/astroquery/Hitran/tempfile_CO_1_1900.00_2300.00.h5
Using cache file: /home/docs/.astropy/cache/astroquery/Hitran/tempfile_CO_2_1900.00_2300.00.h5
Using cache file: /home/docs/.astropy/cache/astroquery/Hitran/tempfile_CO_3_1900.00_2300.00.h5
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          None
   broadening_method    voigt
   cutoff               1e-27 cm-1/(#.cm-2)
   dbformat             hitran
   dbpath               fetched from hitran
   dlm_log_pG           0.1375350788016573
   dlm_log_pL           0.20180288881201608
   export_rovib_fraction  True
   folding_thresh       1e-06
   hdf5_engine          pytables
   include_neighbouring_lines  True
   levelsfmt            None
   neighbour_lines      0 cm-1
   optimization         min-RMS
   parfuncfmt           hapi
   parfuncpath          None
   parsum_mode          full summation
   pseudo_continuum_threshold  0
   truncation           50 cm-1
   wavenum_max_calc     2300.0000 cm-1
   wavenum_min_calc     1900.0000 cm-1
   waveunit             cm-1
   wstep                0.01 cm-1
   zero_padding         -1
Information
----------------------------------------
   chunksize            None
   db_use_cached        True
   export_lines         False
   export_populations   None
   load_energies        False
   lvl_use_cached       True
   total_lines          742
   warning_broadening_threshold  0.01
   warning_linestrength_cutoff  0.01
----------------------------------------
0.06s - 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.576 seconds)

Gallery generated by Sphinx-Gallery