Creating interactive animated data presentations in notebooks often requires complex code with multiple visualization libraries, resulting in non-linear storytelling and difficult-to-follow transitions between different chart states.
import seaborn as sns
df = sns.load_dataset("penguins")
df = df[['species', 'sex']].dropna()
df = df.astype("object")
df["count"] = 1
df.head(10)
species | sex | count | |
---|---|---|---|
0 | Adelie | Male | 1 |
1 | Adelie | Female | 1 |
2 | Adelie | Female | 1 |
4 | Adelie | Female | 1 |
5 | Adelie | Male | 1 |
6 | Adelie | Female | 1 |
7 | Adelie | Male | 1 |
12 | Adelie | Female | 1 |
13 | Adelie | Male | 1 |
14 | Adelie | Male | 1 |
# Traditional approach: Multiple separate visualizations
import seaborn as sns
import matplotlib.pyplot as plt
# First view - grouped bar chart
plt.figure(1)
sns.barplot(data=df, x='sex', y='count')
plt.show()
# Second view - separate plot for stacked bars
plt.figure(2)
sns.barplot(data=df, x='count', y='species', hue='sex')
plt.show()
# No smooth transitions between views
# Manual navigation between plots
ipyvizzu-story enables creation of fluid data stories with smooth transitions between insights:
from ipyvizzu import Data, Config
from ipyvizzustory import Story, Slide, Step
data = Data()
data.add_df(df)
story = Story(data=data)
slide1 = Slide(
Step(Config({"x": ["count", "sex"], "label": ["count", "sex"], "color": "sex"}))
)
story.add_slide(slide1)
slide2 = Slide(
Step(Config({"x": "count", "y": ["species", "sex"]}),)
)
story.add_slide(slide2)
story.play()
The example shows how ipyvizzu-story simplifies creating interactive presentations by handling transitions automatically. You define different views as slides, and the library creates smooth animations between them, including keyboard navigation controls.