Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tdegeus/openscienceplot_matplotlib
Share data from a plot
https://github.com/tdegeus/openscienceplot_matplotlib
Last synced: 11 days ago
JSON representation
Share data from a plot
- Host: GitHub
- URL: https://github.com/tdegeus/openscienceplot_matplotlib
- Owner: tdegeus
- License: mit
- Created: 2021-01-29T13:51:11.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-07-06T08:38:31.000Z (over 3 years ago)
- Last Synced: 2024-10-08T09:51:26.307Z (29 days ago)
- Language: Python
- Size: 15.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openscienceplot_matplotlib
The goal of this library is to allow you to share the raw-data from a (scientific) plot
in an open way.
In particular:* You choose the data that matters to you, and you choose how you organise the
data-file that you share.
* Only open (and free!) data file-types are used.
* Where possible, the amount of code you need to create the data-file is minimal.> A long-term gaol is to have similar libraries for different languages
> (e.g. Python/matplotlib, Matlab, ...)
> and different file-type
> (e.g. HDF5, yaml, JSON, ...)
> to allow sharing data is a custom but still somewhat unified way.# Usage
Please consider this minimal example
## Store to HDF5
```python
import numpy as np
import h5py
import matplotlib.pyplot as plt
import openscienceplot_matplotlib as ospwith h5py.File('mydata.hdf5', 'w') as data:
fig, ax = plt.subplots()
x = np.linspace(0, 1, 1000)
y = x ** 2handle = ax.plot(x, y, color='r', label='myplot')
osp.write_h5py(data, 'data', handle)
data['by'] = osp.info()fig.savefig('myplot.pdf')
plt.close(fig)
```