Create gif from your plotly figures!
Project description
Plotly-gif
A simple python package to generate .gif from your plotly figures. It works for both 2D and 3D figures. It can even create_gif motion for you in 3D plots.
Installation
pip install plotly-gif
Dependencies
If you are already using plotly, then you should be good. But, just in case, these are the dependencies:
pip install plotly
pip install kaleido # used by plotly to generate png
pip install Pillow # used to convert png to gif
Usage
There are three common methods:
Built-in Functions/ Macros
Currently, we have the follow:
- two_d_time_series
- three_d_scatter_rotate
- more to come... or submit your own
import plotly.graph_objs as go
from plotly_gif import GIF, two_d_time_series
fig = go.Figure()
# add your traces()
# add your formatting()
gif = GIF()
two_d_time_series(gif, fig)
Decorator
If you have a function that is changing the `go.Figure' with each loop, you can add the decorator to the func.
import plotly.graph_objs as go
from plotly_gif import GIF, capture
gif = GIF()
@capture(gif)
def plot_(x_, y_):
fig = go.Figure()
# add your traces()
# add your formatting()
return fig
gif.create_gif() # generate gif
In-Line
This very similar to the decorator option, but you can call the image capture function directly.
import plotly.graph_objs as go
from plotly_gif import GIF, capture
gif = GIF()
def plot_(x_, y_):
fig = go.Figure()
# add your traces()
# add your formatting()
gif.create_image(fig) # create_gif image for gif
return fig
gif.create_gif() # generate gif
Options
Examples
See examples folder
Notes:
Time to generate gif (60 images per gif)
- Simple 2D plots with small data sets (100 pts): ~10 sec
- Simple 3D plots with small data sets (100 pts): ~1.5 min
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
plotly_gif-0.0.3.tar.gz
(7.5 kB
view hashes)
Built Distribution
Close
Hashes for plotly_gif-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5bdd86ac96cfa9156c061807a0cea2fbdefc3ff4f58810885d143b5fb259a43f |
|
MD5 | 9147cb84039b3e70112c586a7fba99b2 |
|
BLAKE2b-256 | 85cb9950ac6e9ebe7f29fb6a8e5e3251c6de2a3fe57fe360cc7415ec24cb4966 |