ctaplot styles

ctaplot comes with different styles, based on seaborn-deep with a couple adjustements.

  • notebook

  • slides

  • paper

On can set ctaplot plot style easily with ctaplot.set_style(). Or use the context manager.

[1]:
import ctaplot
import matplotlib.pyplot as plt
import matplotlib as mpl

%matplotlib inline

Default matplotlib style

[2]:
mpl.rcParams.update(mpl.rcParamsDefault)

ctaplot.plot_effective_area_cta_performance('north')
ctaplot.plot_effective_area_cta_performance('south')
ctaplot.plot_effective_area_cta_requirement('north')
ctaplot.plot_effective_area_cta_requirement('south')
plt.show()
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:489: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:456: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
../_images/notebooks_style_3_1.png

notebook style

  • larger figures

  • no LaTeX distribution required (faster to plot)

[3]:
ctaplot.set_style('notebook')
[4]:
ctaplot.plot_effective_area_cta_performance('north')
ctaplot.plot_effective_area_cta_performance('south')
ctaplot.plot_effective_area_cta_requirement('north')
ctaplot.plot_effective_area_cta_requirement('south')
plt.show()
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:489: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:456: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
../_images/notebooks_style_6_1.png

Slides style

  • larger figures

  • LaTeX distribution used if available (longer to plot)

[5]:
mpl.rcParams.update(mpl.rcParamsDefault)
ctaplot.set_style('slides')
[6]:
ctaplot.plot_effective_area_cta_performance('north')
ctaplot.plot_effective_area_cta_performance('south')
ctaplot.plot_effective_area_cta_requirement('north')
ctaplot.plot_effective_area_cta_requirement('south')
plt.show()
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:489: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:456: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
../_images/notebooks_style_9_1.png

Paper style

  • LaTeX distribution used if available (longer to plot)

  • plots with a width equal to one column in two-columns articles

[7]:
mpl.rcParams.update(mpl.rcParamsDefault)
ctaplot.set_style('paper')
[8]:
ctaplot.plot_effective_area_cta_performance('north')
ctaplot.plot_effective_area_cta_performance('south')
ctaplot.plot_effective_area_cta_requirement('north')
ctaplot.plot_effective_area_cta_requirement('south')
plt.show()
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:489: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:456: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
../_images/notebooks_style_12_1.png

Context management

You can also use the context manager to change the style temporarily.

[9]:
# Let's reset the style to the default one first

import matplotlib as mpl
mpl.rcParams.update(mpl.rcParamsDefault)
ctaplot.plot_effective_area_cta_performance('north')
ctaplot.plot_effective_area_cta_performance('south')
plt.show()
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:489: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
../_images/notebooks_style_14_1.png
[10]:
with ctaplot.plots.style.context('notebook'):
    ctaplot.plot_effective_area_cta_performance('north')
    ctaplot.plot_effective_area_cta_performance('south')
plt.show()
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:489: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
../_images/notebooks_style_15_1.png
[11]:
with ctaplot.plots.style.context('slides'):
    ctaplot.plot_effective_area_cta_performance('north')
    ctaplot.plot_effective_area_cta_performance('south')
plt.show()
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:489: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
../_images/notebooks_style_16_1.png
[12]:
with ctaplot.plots.style.context('paper'):
    ctaplot.plot_effective_area_cta_performance('north')
    ctaplot.plot_effective_area_cta_performance('south')
plt.show()
/home/docs/checkouts/readthedocs.org/user_builds/ctaplot/envs/latest/lib/python3.11/site-packages/ctaplot/plots/plots.py:489: UserWarning: This axis already has a converter set and is updating to a potentially incompatible converter
  ax.plot(e_cta, ef_cta, **kwargs)
../_images/notebooks_style_17_1.png
[ ]: