Py.Cafe

huong-li-nguyen/

vizro-tips-analysis

Exploring Tips Data with Vizro

DocsPricing
  • assets/
  • yaml_version/
  • app.py
  • data.yaml
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Scratchpad for testing."""

import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro

tips = px.data.tips()

page1 = vm.Page(
    title="Default",
    layout=vm.Grid(grid=[[1, 2], [0, 0]]),
    components=[
        vm.Card(text="""# Good morning!"""),
        vm.Graph(
            title="Where do we get more tips?",
            figure=px.bar(tips, y="tip", x="day"),
        ),
        vm.Graph(
            title="Is the average driven by a few outliers?",
            figure=px.violin(tips, y="tip", x="day", color="day", box=True),
        ),
    ],
    controls=[vm.Filter(column="day")],
)


dashboard = vm.Dashboard(pages=[page1])


Vizro().build(dashboard).run()