Py.Cafe

huong-li-nguyen/

vizro-iris-visualization-2

Graphical Representation of Iris Dataset

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""Test app"""

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

iris = px.data.iris()

page = vm.Page(
    title="Colored Container",
    layout=vm.Layout(grid=[[0, 3, 3, 3, 4, 4], [1, 3, 3, 3, 4, 4], [2, 3, 3, 3, 4, 4]]),
    components=[
        vm.Card(text="""Hello, this is a card with a [link](https://www.google.com)"""),
        vm.Card(text="""Hello, this is a card with a [link](https://www.google.com)"""),
        vm.Card(text="""Hello, this is a card with a [link](https://www.google.com)"""),
        vm.Container(
            title="Container I",
            components=[
                vm.Graph(figure=px.scatter(iris, x="sepal_width", y="sepal_length", color="species")),
            ],
            background=True,
        ),
        vm.Container(
            title="Container II",
            components=[
                vm.Graph(figure=px.scatter(iris, x="sepal_width", y="sepal_length", color="species")),
            ],
        ),
    ],
)

page_two = vm.Page(
    title="Non-colored Container",
    components=[
        vm.Container(
            title="Container III",
            components=[
                vm.Graph(figure=px.scatter(iris, x="sepal_width", y="sepal_length", color="species")),
            ],
        ),
    ],
)

dashboard = vm.Dashboard(pages=[page, page_two])


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