2025faCSE160/bigos/lecture20251112/plotly/AnimatedScatterPlot.py

21 lines
No EOL
412 B
Python

import plotly.express as px
data = px.data.gapminder( )
fig = px.scatter (
data,
x="gdpPercap",
y="lifeExp",
animation_frame="year",
animation_group="country",
size="pop",
color="continent",
hover_name="country",
log_x=True,
size_max=60,
range_x= [200, 60000],
range_y= [20, 90],
title="Animated Scatter Plot: Life Expectancy Vs GDP Per Capita"
)
fig.show()