from chemparseplot.plot.structs import EnergyPath, BasePlotter, TwoDimPlot, XYData
from chemparseplot.plot.geomscan import plot_energy_paths
from chemparseplot.units import ureg
import numpy as np
import matplotlib.pyplot as plt
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[1], line 1
----> 1 from chemparseplot.plot.structs import EnergyPath, BasePlotter, TwoDimPlot, XYData
      2 from chemparseplot.plot.geomscan import plot_energy_paths
      3 from chemparseplot.units import ureg

File ~/work/chemparseplot/chemparseplot/chemparseplot/plot/__init__.py:5
      1 # SPDX-FileCopyrightText: 2023-present Rohit Goswami <rog32@hi.is>
      2 #
      3 # SPDX-License-Identifier: MIT
----> 5 from chemparseplot.plot.theme import (
      6     RUHI_COLORS,
      7     RUHI_THEME,
      8     PlotTheme,
      9     get_theme,
     10     setup_global_theme,
     11     setup_publication_theme,
     12 )
     15 # Lazy imports for submodules with heavy deps (cmcrameri, pint, etc.)
     16 def __getattr__(name):

File ~/work/chemparseplot/chemparseplot/chemparseplot/plot/theme.py:10
      7 import logging
      8 from dataclasses import dataclass, replace
---> 10 import matplotlib as mpl
     11 import matplotlib.pyplot as plt
     12 from matplotlib.colors import LinearSegmentedColormap

ModuleNotFoundError: No module named 'matplotlib'

Overview

We plan to facilitate two kinds of plots:

  • One-shot paths on multiple files / data sources

  • Interactive plots

The reason why is simple, often one wishes to plot a couple of paths and add or remove paths which aren’t very useful.

One-shot multi-plot

path1 = EnergyPath('Path 1', np.linspace(0, 10, 30) * ureg.angstrom, np.random.uniform(-1, 0, 30) * ureg.hartree)
path2 = EnergyPath('Path 2', np.linspace(1, 9, 25) * ureg.angstrom, np.random.uniform(-0.5, 0.5, 25) * ureg.hartree)
plot_energy_paths([path1, path2], {'distance': 'angstrom', 'energy': 'hartree'}, colormap_fraction=0.4);

Interactive plots

twodim_plot = TwoDimPlot()
twodim_plot.set_labels('Distance', 'Energy')
twodim_plot.set_units('angstrom', 'hartree')

# Add XYData
data1 = XYData('Path 1', np.linspace(0, 10, 30) * ureg.angstrom, np.random.uniform(-1, 0, 30) * ureg.hartree)
data2 = XYData('Path 2', np.linspace(1, 9, 25) * ureg.angstrom, np.random.uniform(-0.5, 0.5, 25) * ureg.hartree)
data3 = XYData('Path 3', np.linspace(1, 9, 25) * ureg.bohr, np.random.uniform(-0.5, 0.5, 25) * ureg.hartree)
twodim_plot.add_data(data1)
twodim_plot.add_data(data2)

twodim_plot.add_title("Two Dimensional Data Plot")
twodim_plot.set_units('angstrom', 'electron_volt')
twodim_plot.fig
twodim_plot.add_data(data3)
twodim_plot.fig
max(data3.x.to("angstrom"))