Neural Sync Active
Plotly
Registry Synced
Plotly
74 words
1 min read
Plotly
pythonimport plotly.express as px import plotly.graph_objects as go import pandas as pd import numpy as np df = px.data.gapminder() # Scatter plot with animation fig = px.scatter(df, x='gdpPercap', y='lifeExp', size='pop', color='continent', log_x=True, size_max=60, animation_frame='year', title='Gapminder Data over Time') fig.show() # Line chart fig = go.Figure() for continent in df['continent'].unique(): subset = df[df['continent'] == continent] fig.add_trace(go.Scatter( x=subset['year'], y=subset['lifeExp'], mode='lines', name=continent )) fig.update_layout(title='Life Expectancy by Continent') fig.show()