Styles

Load the RingCyclotron.stat file

[1]:
from opal import load_dataset

ds = load_dataset('./RingCyclotron/', fname='RingCyclotron.stat')

Load styles

[2]:
from opal.visualization.styles import load_style

Jupyter style

[3]:
load_style('jupyter')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[3], line 1
----> 1 load_style('jupyter')

File ~/pyOPALTools/opal/visualization/styles/load_style.py:31, in load_style(use)
     29 from opal.utilities.logger import opal_logger
     30 opal_logger.info("Loading '" + use + "' plotting style")
---> 31 eval(use + '()')

File <string>:1

File ~/pyOPALTools/opal/visualization/styles/jupyter.py:31, in jupyter()
     29 # reset
     30 from opal.visualization.styles.default import default
---> 31 default()
     33 if mpl.__version__ < '2':
     34     opal_logger.error('jupyter style not available for matplotlib version ' + mpl.__version__)

File ~/pyOPALTools/opal/visualization/styles/default.py:38, in default()
     36 mpl.rcParams['lines.linestyle']         = '-'           # solid line
     37 mpl.rcParams['lines.color']             = 'C0'          # has no affect on plot(); see axes.prop_cycle
---> 38 mpl.rcParams['lines.marker']            = None          # the default marker
     39 mpl.rcParams['lines.markeredgewidth']   = 1.0           # the line width around the marker symbol
     40 mpl.rcParams['lines.markersize']        = 6             # markersize, in points

File /usr/local/lib/python3.8/dist-packages/matplotlib/__init__.py:722, in RcParams.__setitem__(self, key, val)
    720         cval = self.validate[key](val)
    721     except ValueError as ve:
--> 722         raise ValueError(f"Key {key}: {ve}") from None
    723     self._set(key, cval)
    724 except KeyError as err:

ValueError: Key lines.marker: Could not convert None to str
[4]:
plt = ds.plot_profile1D('time', 'Bx_ref', xsci=True)

plt.show()
_images/Styles_7_0.svg

Default style

[5]:
load_style('default')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[5], line 1
----> 1 load_style('default')

File ~/pyOPALTools/opal/visualization/styles/load_style.py:31, in load_style(use)
     29 from opal.utilities.logger import opal_logger
     30 opal_logger.info("Loading '" + use + "' plotting style")
---> 31 eval(use + '()')

File <string>:1

File ~/pyOPALTools/opal/visualization/styles/default.py:38, in default()
     36 mpl.rcParams['lines.linestyle']         = '-'           # solid line
     37 mpl.rcParams['lines.color']             = 'C0'          # has no affect on plot(); see axes.prop_cycle
---> 38 mpl.rcParams['lines.marker']            = None          # the default marker
     39 mpl.rcParams['lines.markeredgewidth']   = 1.0           # the line width around the marker symbol
     40 mpl.rcParams['lines.markersize']        = 6             # markersize, in points

File /usr/local/lib/python3.8/dist-packages/matplotlib/__init__.py:722, in RcParams.__setitem__(self, key, val)
    720         cval = self.validate[key](val)
    721     except ValueError as ve:
--> 722         raise ValueError(f"Key {key}: {ve}") from None
    723     self._set(key, cval)
    724 except KeyError as err:

ValueError: Key lines.marker: Could not convert None to str
[6]:
plt = ds.plot_profile1D('time', 'Bx_ref', xsci=True)

plt.show()
_images/Styles_10_0.svg

Poster Style

[7]:
load_style('poster')
[8]:
plt = ds.plot_profile1D('time', 'Bx_ref', xsci=True)

plt.show()
_images/Styles_13_0.svg

Switch back to Jupyter style

[9]:
load_style('jupyter')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[9], line 1
----> 1 load_style('jupyter')

File ~/pyOPALTools/opal/visualization/styles/load_style.py:31, in load_style(use)
     29 from opal.utilities.logger import opal_logger
     30 opal_logger.info("Loading '" + use + "' plotting style")
---> 31 eval(use + '()')

File <string>:1

File ~/pyOPALTools/opal/visualization/styles/jupyter.py:31, in jupyter()
     29 # reset
     30 from opal.visualization.styles.default import default
---> 31 default()
     33 if mpl.__version__ < '2':
     34     opal_logger.error('jupyter style not available for matplotlib version ' + mpl.__version__)

File ~/pyOPALTools/opal/visualization/styles/default.py:38, in default()
     36 mpl.rcParams['lines.linestyle']         = '-'           # solid line
     37 mpl.rcParams['lines.color']             = 'C0'          # has no affect on plot(); see axes.prop_cycle
---> 38 mpl.rcParams['lines.marker']            = None          # the default marker
     39 mpl.rcParams['lines.markeredgewidth']   = 1.0           # the line width around the marker symbol
     40 mpl.rcParams['lines.markersize']        = 6             # markersize, in points

File /usr/local/lib/python3.8/dist-packages/matplotlib/__init__.py:722, in RcParams.__setitem__(self, key, val)
    720         cval = self.validate[key](val)
    721     except ValueError as ve:
--> 722         raise ValueError(f"Key {key}: {ve}") from None
    723     self._set(key, cval)
    724 except KeyError as err:

ValueError: Key lines.marker: Could not convert None to str
[10]:
plt = ds.plot_profile1D('time', 'Bx_ref', xsci=True)

plt.show()
_images/Styles_16_0.svg