Plot reaction profiles with customizable curves and labels
Project description
plotProfile
Python code for plotting professional looking reaction profiles with various customisation options available
Installation
Local installation (may not respect the styles.json):
git clone git@github.com:aligfellow/plotProfile.git
cd plotProfile
pip install .
From pypi
pip install plotprofile
Python Usage examples
Use case for example:
from plotProfile import ReactionProfilePlotter
energy_sets = {
"Pathway A": [0.00, -2.0, 10.2, 1.4, -1.5, 2.0, -7.2],
"Pathway B": [None, -2.0, 6.2, 4.3, 5.8, 2.0],
"Pathway C": [None, -2.0, -6.8,-6.8],
}
annotations = {
'Step 1': (0,3),
'Step 2': (3,5),
'Step 3': (5,6),
}
plotter = ReactionProfilePlotter(dashed=["Pathway C"])
plotter.plot(energy_sets, annotations=annotations, filename="../images/profile1")
Pass in annotations for labelling of the reaction profile:
- this is done in the plotting function rather than the class
- allowing for multiple plots of the same style with different annotations
A variety of paremters can be tuned for the plotting, including:
axes="box|y|x|both|None"curviness=0.42- reduce for less curve and vice versacolors=["list","of","colors"]|cmap- specify colour list or colour mapshow_legend=Boolunits="kj|kcal"energy="e|electronic|g|gibbs|h|enthalpy|s|entropy|"
For example:
plotter = ReactionProfilePlotter(style="presentation", dashed=["Pathway B"], point_type='bar', desaturate=False, colors='Blues_r', show_legend=False, curviness=0.5)
plotter.plot(energy_sets, filename="../images/profile2")
Using style="presentation" which sets a larger figsize=(X,X), thicker lines, larger font size:
For example:
plotter = ReactionProfilePlotter(style="straight", figsize=(6,4), dashed=["Pathway C"], point_type='dot', annotation_color='black', axes='y', colors=['darkseagreen', 'slateblue', 'darksalmon'], energy='electronic', units='kj')
plotter.plot(energy_sets,annotations=annotations, filename="../images/profile3")
Straight lines set in a style, which can also be done by passing in curviness=0:
See examples/example.ipynb for more explicit code
Further details
- Secondary curves can begin from after the 1st point, just need to have a
Noneentry in the list of energies - Spacing of energies can be altered by passing the same energy twice in a row
- this will place the point halfway between the two x indices,
- i.e. Pathway C point in examples
- this will place the point halfway between the two x indices,
CLI - to do...
Currently untested - probably won't work for now
python -m plotProfile --input examples/input.json --labels --format png
To Do
- label placement is primitive and could be improved
- for now these can be tweaked with postprocessing
- check cli options
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file plotprofile-1.0.1.tar.gz.
File metadata
- Download URL: plotprofile-1.0.1.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ca05e633c4ee15e3ce4459d5cc9fa91d990ef3ce9568c5cb0373baf2e0c2179
|
|
| MD5 |
f7a3f0792c292e2c5e4b60a447010f70
|
|
| BLAKE2b-256 |
5dbeec72ed0028bc2e82b20a4d9ed18416eda33b7805c0d1f026b676bef34334
|
File details
Details for the file plotprofile-1.0.1-py3-none-any.whl.
File metadata
- Download URL: plotprofile-1.0.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.18
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0f910862231be55762c4480211a941aeca0025f04dc69308afef66970e823df
|
|
| MD5 |
69e7ddcfd6f21b74f29d58cfbf208220
|
|
| BLAKE2b-256 |
66ed84431ce7b04bd30431ffd00dbd7872cd413aba29af61469fda3594c3dbd2
|