A basic package to turn plots into gifs
Project description
gify_plot
A simple Python package to turn your plots into gifs (Matplotlib, Seabron, Plotly)
How to install it
pip install gify_plot
Args
Mandatory
- original_df:pd.DataFrame ==> a dataset containing at least three columns: xaxis_title (i.e., x values), yaxis_title (i.e., y values), category (i.e., groups)
- plot_type:str ==> The plot_type changes according to plot_library
- plot_library:str ==> plt | sns | px (short forms for matplotlib.pyplot, seaborn and plotly.express)
- name:str ==> The name of pngs and gif given as output,
- plot_title:str
- xaxis_title:str ==> The name of the column with x values
- yaxis_title:str ==> The name of the column with y values
Optional
- colors = ["blue","red","green","orange","violet","yellow","black","brown","cyan"] ==> it must have at least the same length of groups provided in the provided data
- duration = 100 ==> The delay in skipping to the next frame in ms
- loop = 0
- save_frames = True ==> If False, delete all png files that have been used to create the gif
How to use it
# WARNING:
# Using more than 5/7 categories ends with a cluttered result.
# The fewer, the better.
# The following csv can be freely downlaoded at https://www.kaggle.com/datasets/sazidthe1/world-gdp-data?select=gdp_data.csv
df=pd.read_csv("gdp_data.csv")
temp_df=df[(df["country_name"].isin(["Italy","Spain"]))]
gify_plot(temp_df,
plot_type="line", plot_library="plt", name="test_gif",
plot_title="GDP per country", xaxis_title="year", yaxis_title="value", category="country_code",
save_frames=False
)
OUTPUT: It ouputs a list of png in the dedicated folder, along with the resulting gif.
Supported libraries and plots:
- plt (i.e., matplotlib.pyplot):
- line
- bar
- scatter
- stackplot (no legend)
- sns (i.e., seaborn):
- lineplot
- scatterplot
- barplot
- px (i.e., plotly.express):
- line
- scatter
- area
- bar
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
gify_plot-0.0.7.tar.gz
(4.0 kB
view hashes)
Built Distribution
Close
Hashes for gify_plot-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba009c4b8f97f1aa79db5df6d1dd538625b5e9c3e00f28a938cd058964e703fd |
|
MD5 | 47cb61592faaa707c0518f13b0b61722 |
|
BLAKE2b-256 | 55431377348c14fa6b61a04aa68e5013fc6e6771cac0b5ca585e379be5119826 |