File size: 452 Bytes
42ee455
b699ae9
42ee455
 
 
 
 
b699ae9
 
42ee455
 
 
 
b699ae9
42ee455
b699ae9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import pandas as pd
import plotly.graph_objects as go
import vizro.plotly.express as px
from vizro.models.types import capture


@capture("graph")
def categorical_column(data_frame: pd.DataFrame, **kwargs) -> go.Figure:
    fig = px.bar(data_frame, **kwargs)
    fig.update_xaxes(type="category")
    return fig


gapminder = px.data.gapminder().query("country == 'Nigeria' and year > 1970")

fig = categorical_column(gapminder, x="year", y="lifeExp")