Create matplotlib/plotly hybrid plots with a few lines of code.
Project description
interplot
Create matplotlib/plotly
hybrid plots with a few lines of code.
It combines the best of the matplotlib
and the plotly
worlds through
a unified, flat API.
All the necessary boilerplate code is contained in this module.
Currently supported building blocks:
- scatter plots
line
scatter
linescatter
- histogram
hist
- boxplot
boxplot
- heatmap
heatmap
- linear regression
regression
- line fill
fill
- annotations
text
Supported
- 2D subplots
- automatic color cycling
- 3 different API modes
-
One line of code
>>> interplot.line([0,4,6,7], [1,2,4,8]) [plotly line figure] >>> interplot.hist(np.random.normal(40, 8, 1000), interactive=False) [plotly hist figure] >>> interplot.boxplot( >>> [ >>> np.random.normal(20, 5, 1000), >>> np.random.normal(40, 8, 1000), >>> np.random.normal(60, 5, 1000), >>> ], >>> ) [matplotlib boxplots]
-
Decorator to auto-initialize plots to use in your methods
>>> @interplot.magic_plot >>> def plot_my_data(fig=None): >>> # import and process your data... >>> data = np.random.normal(2, 3, 1000) >>> # draw with the fig instance obtained from the decorator function >>> fig.add_line(data, label="my data") >>> fig.add_fill((0, 999), (-1, -1), (5, 5), label="sigma") >>> plot_my_data(title="My Recording") [plotly figure "My Recording"] >>> @interplot.magic_plot_preset(interactive=False, title="Preset Title") >>> def plot_my_data_preconfigured(fig=None): >>> # import and process your data... >>> data = np.random.normal(2, 3, 1000) >>> # draw with the fig instance obtained from the decorator function >>> fig.add_line(data, label="my data") >>> fig.add_fill((0, 999), (-1, -1), (5, 5), label="sigma") >>> plot_my_data_preconfigured() [matplotlib figure "Preset Title"]
-
The
interplot.Plot
class for full control>>> fig = interplot.Plot( >>> interactive=True, >>> title="Everything Under Control", >>> fig_size=(800, 500), >>> rows=1, >>> cols=2, >>> shared_yaxes=True, >>> # ... >>> ) >>> fig.add_hist(np.random.normal(1, 0.5, 1000), row=0, col=0) >>> fig.add_boxplot( >>> [ >>> np.random.normal(20, 5, 1000), >>> np.random.normal(40, 8, 1000), >>> np.random.normal(60, 5, 1000), >>> ], >>> row=0, >>> col=1, >>> ) >>> # ... >>> fig.post_process() >>> fig.show() [plotly figure "Everything Under Control"] >>> fig.save("export/path/file.html") saved figure at export/path/file.html
-
Resources
- Documentation: https://interplot.janjo.ch
- Source Code: https://github.com/janjoch/interplot
- PyPI: https://pypi.org/project/interplot/
Licence
Demo
Install
pip install interplot
dev installation
git clone https://github.com/janjoch/interplot
cd interplot
pip install -e .
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
interplot-0.1.1.tar.gz
(39.4 kB
view hashes)
Built Distribution
interplot-0.1.1-py3-none-any.whl
(39.2 kB
view hashes)
Close
Hashes for interplot-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6d938841082151cdc97a4b195cdad285ddfda1286e669f043da26955f54b346 |
|
MD5 | bec6e21f12a25925eb53a2e155c550f7 |
|
BLAKE2b-256 | 720b9596ca706aac044958326cbadfdcb4de1ed776a44a8d0cf131fa37839491 |