File size: 5,798 Bytes
42ee455
 
 
 
 
b699ae9
 
42ee455
b699ae9
42ee455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
42ee455
 
 
 
b699ae9
42ee455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
42ee455
 
 
 
b699ae9
42ee455
b699ae9
42ee455
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
 
42ee455
 
 
b699ae9
2465927
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b699ae9
 
 
 
 
 
 
 
 
 
 
 
2465927
 
 
42ee455
b699ae9
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
"""Distribution charts."""

import vizro.models as vm

from pages._factories import butterfly_factory
from pages._pages_utils import PAGE_GRID, make_code_clipboard_from_py_file
from pages.examples import boxplot, dumbbell, histogram, violin

violin_page = vm.Page(
    title="Violin",
    path="distribution/violin",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""

            #### What is a violin chart?

            A violin chart is similar to a box plot, but works better for visualizing more complex distributions and
            their probability density at different values.

             

            #### When should I use it?

            Use this chart to go beyond the simple box plot and show the distribution shape of the data, the
            inter-quartile range, the confidence intervals and the median.
        """
        ),
        vm.Graph(figure=violin.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard", components=[make_code_clipboard_from_py_file("violin.py", mode="vizro")]
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("violin.py", mode="plotly")],
                ),
            ]
        ),
    ],
)

boxplot_page = vm.Page(
    title="Boxplot",
    path="distribution/boxplot",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""

            #### What is a boxplot?

            A box plot (also known as whisker plot) provides a visual display of multiple datasets,
            indicating the median (center) and the range of the data for each.

             

            #### When should I use it?

            Choose a box plot when you need to summarize distributions between many groups or datasets. It takes up
            less space than many other charts.

            Create boxes to display the median, and the upper and lower quartiles. Add whiskers to highlight
            variability outside the upper and lower quartiles. You can add outliers as dots beyond, but in line with
            the whiskers.
        """
        ),
        vm.Graph(figure=boxplot.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard", components=[make_code_clipboard_from_py_file("boxplot.py", mode="vizro")]
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("boxplot.py", mode="plotly")],
                ),
            ]
        ),
    ],
)

butterfly_page = butterfly_factory("distribution")

histogram_page = vm.Page(
    title="Histogram",
    path="distribution/histogram",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""
            #### What is a histogram?

            A histogram organizes numerical data into columns, with the size of each column representing how frequently
            values fall within specified ranges. It visualizes data across a continuous interval.

             

            #### When should I use it?

            A histogram is useful for showing your audience where specific values are concentrated, identifying the
            extremes, and spotting any gaps or outliers. It can also help you visualize a rough probability
            distribution. Ensure that the gaps between columns are minimal to make the 'shape' of your data
            immediately clear.
        """
        ),
        vm.Graph(figure=histogram.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard", components=[make_code_clipboard_from_py_file("histogram.py", mode="vizro")]
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("histogram.py", mode="plotly")],
                ),
            ]
        ),
    ],
)

dumbbell_page = vm.Page(
    title="Dumbbell",
    path="distribution/dumbbell",
    layout=vm.Layout(grid=PAGE_GRID),
    components=[
        vm.Card(
            text="""
            #### What is a dumbbell chart?
            A dumbbell chart emphasizes the gap between two categorical groups. Each data point is depicted by a
            symbol, typically a circle, representing its quantitative value. These symbols are connected by a line,
            visually indicating the gap between the two points. Categories or groups are displayed along one axis,
            while quantitative values are plotted along the other.

             

            #### When should I use it?
            Dumbbell charts are ideal for illustrating differences or gaps between two points. They are less cluttered
            than bar charts, making it easier to compare groups. Common uses include comparing groups, such as showing
            differences in performance metrics across various categories. Colors can be used to emphasize the direction
            of changes or to distinguish between categories.
        """
        ),
        vm.Graph(figure=dumbbell.fig),
        vm.Tabs(
            tabs=[
                vm.Container(
                    title="Vizro dashboard", components=[make_code_clipboard_from_py_file("dumbbell.py", mode="vizro")]
                ),
                vm.Container(
                    title="Plotly figure",
                    components=[make_code_clipboard_from_py_file("dumbbell.py", mode="plotly")],
                ),
            ]
        ),
    ],
)


pages = [violin_page, boxplot_page, butterfly_page, dumbbell_page, histogram_page]