Unified scientific charting: scienceplots + a matplotlib-portable Vega-Lite preset
Project description
molcrafts-molplot
Unified scientific charting for the MolCrafts stack — the Python / matplotlib half of MolPlot.
It wraps scienceplots and injects
MolPlot's unified preset (palette, type scale, grid, light/dark) so a figure
made here matches the same preset rendered in the browser by the TypeScript
package @molcrafts/molplot.
The bridge between the two renderers is the Vega-Lite spec — a portable JSON intermediate language. Build a spec in Python and either ship it to the web or render it to matplotlib for a publication figure.
Install
pip install molcrafts-molplot
# optional exact web-parity export (real Vega engine → PNG/SVG):
pip install "molcrafts-molplot[convert]"
Style — scienceplots + unified preset
import matplotlib.pyplot as plt
import molplot
molplot.use("molplot") # scienceplots base + MolPlot overlay
# or a publication variant (serif, high-DPI, scienceplots 'nature' base):
molplot.use("molplot-paper")
with molplot.style("molplot", mode="dark"):
plt.plot(x, y) # scoped; restores rcParams on exit
molplot.palette()[0] # '#1f77b4' — same categorical colours as the web
plt.style.use("molplot") also works directly (the .mplstyle files are
registered on import) — but molplot.use() additionally layers the scienceplots
base styles named by the preset.
Charts — one call, or via the portable spec
# one call → (fig, ax)
fig, ax = molplot.line(
[{"id": "E_total", "x": steps, "y": e_total},
{"id": "E_kin", "x": steps, "y": e_kin}],
x_label="step", y_label="energy (kcal/mol)", show_legend=True,
)
# or build the Vega-Lite spec and choose a renderer:
spec = molplot.scatter_spec(pc1, pc2, color=cluster_id, colorscale="viridis")
fig, ax = molplot.render(spec) # matplotlib (scienceplots)
molplot.to_png(spec, "fig.png") # exact web parity via vl-convert (optional)
import json; json.dumps(spec) # ship the same spec to the browser
line_spec / scatter_spec / bar_spec / gantt_spec emit the same Vega-Lite
shapes as the TypeScript @molcrafts/molplot builders.
License
BSD-3-Clause
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 molcrafts_molplot-0.1.1.tar.gz.
File metadata
- Download URL: molcrafts_molplot-0.1.1.tar.gz
- Upload date:
- Size: 20.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f768457e872bcb51c3cf72369a65af8b10e1783d37a04caf6d15370f77198434
|
|
| MD5 |
6506091104c66141417bb45fe538e648
|
|
| BLAKE2b-256 |
29572df4ca2f685a887f2b77939d1306e6ef4ee9328b3941f65fd2bedebb57b7
|
Provenance
The following attestation bundles were made for molcrafts_molplot-0.1.1.tar.gz:
Publisher:
release-python.yml on MolCrafts/molplot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
molcrafts_molplot-0.1.1.tar.gz -
Subject digest:
f768457e872bcb51c3cf72369a65af8b10e1783d37a04caf6d15370f77198434 - Sigstore transparency entry: 2135043057
- Sigstore integration time:
-
Permalink:
MolCrafts/molplot@d722f53c785945dc435381be76c60f6d4d5dc17b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@d722f53c785945dc435381be76c60f6d4d5dc17b -
Trigger Event:
push
-
Statement type:
File details
Details for the file molcrafts_molplot-0.1.1-py3-none-any.whl.
File metadata
- Download URL: molcrafts_molplot-0.1.1-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9760e0c551d2d7577ac9dba1956eda04f9450444a962bd729f9c842fb91af1a5
|
|
| MD5 |
18508f1be10a5838f144c6549c276898
|
|
| BLAKE2b-256 |
dfaa4ce86495c9fe3fc2769b39d4fd1d577af56f74ad97301498e7d02dd673ea
|
Provenance
The following attestation bundles were made for molcrafts_molplot-0.1.1-py3-none-any.whl:
Publisher:
release-python.yml on MolCrafts/molplot
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
molcrafts_molplot-0.1.1-py3-none-any.whl -
Subject digest:
9760e0c551d2d7577ac9dba1956eda04f9450444a962bd729f9c842fb91af1a5 - Sigstore transparency entry: 2135043089
- Sigstore integration time:
-
Permalink:
MolCrafts/molplot@d722f53c785945dc435381be76c60f6d4d5dc17b -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/MolCrafts
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@d722f53c785945dc435381be76c60f6d4d5dc17b -
Trigger Event:
push
-
Statement type: