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 import geomscan, structs
6 from chemparseplot.units import ureg
8 ureg.setup_matplotlib(True)
File ~/work/chemparseplot/chemparseplot/chemparseplot/plot/geomscan.py:1
----> 1 import matplotlib.pyplot as plt
3 from rgpycrumbs.interpolation import spline_interp
4 from chemparseplot.plot.structs import BasePlotter
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"))