如何在powerpoint文件中为plotly_express plot制作动画?

如何在powerpoint文件中为plotly_express plot制作动画?,express,animation,plotly,powerpoint,Express,Animation,Plotly,Powerpoint,我正在使用plotly express生成一些带有动画的绘图。例如,使用animation\u frame='Year'更改不同年份的散点图。我喜欢将情节复制到Powerpoint文件中。我想知道在我做演示时是否有可能将动画保存在Powerpoint文件中?谢谢 以下是示例代码: import pandas as pd import plotly.express as px import plotly as py url_co2 = 'https://raw.githubusercontent

我正在使用plotly express生成一些带有动画的绘图。例如,使用
animation\u frame='Year'
更改不同年份的散点图。我喜欢将情节复制到Powerpoint文件中。我想知道在我做演示时是否有可能将动画保存在Powerpoint文件中?谢谢

以下是示例代码:

import pandas as pd
import plotly.express as px
import plotly as py

url_co2 = 'https://raw.githubusercontent.com/TrainingByPackt/Interactive-Data-Visualization-with-Python/master/datasets/co2.csv'
url_gm = 'https://raw.githubusercontent.com/TrainingByPackt/Interactive-Data-Visualization-with-Python/master/datasets/gapminder.csv'
co2 = pd.read_csv(url_co2)
gm = pd.read_csv(url_gm)
df_gm = gm[['Country', 'region']].drop_duplicates()
df_w_regions = pd.merge(co2, df_gm, left_on='country', right_on='Country', how='inner')
df_w_regions = df_w_regions.drop('Country', axis='columns')
new_co2 = pd.melt(df_w_regions, id_vars=['country', 'region'])
columns = ['country', 'region', 'year', 'co2']
new_co2.columns = columns
df_co2 = new_co2[new_co2['year'].astype('int64') > 1963]
df_co2 = df_co2.sort_values(by=['country', 'year'])
df_co2['year'] = df_co2['year'].astype('int64')
df_gdp = gm[['Country', 'Year', 'gdp']]
df_gdp.columns = ['country', 'year', 'gdp']
data = pd.merge(df_co2, df_gdp, on=['country', 'year'], how='left')
data = data.dropna()
data.head()

scat1 = px.scatter(data, x = 'gdp', y = 'co2', color = 'region', marginal_y = 'box', marginal_x = 'rug', animation_frame = 'year', animation_group = 'country')
py.offline.plot(scat,filename='output.html')

这是一个非常有趣的问题。您是否考虑共享代码示例?谢谢Vestand。我刚刚添加了一个示例代码。这是一个非常有趣的问题。您是否考虑共享代码示例?谢谢Vestand。我刚刚添加了一个示例代码。