Spaces:
Running
Running
Update app
Browse files- README.md +21 -11
- app.py +1 -1
- assets/css/custom.css +9 -2
- chart_groups.py +42 -45
- requirements.in +1 -1
- requirements.txt +1 -1
README.md
CHANGED
@@ -8,29 +8,39 @@ pinned: false
|
|
8 |
license: apache-2.0
|
9 |
short_description: Vizro - Visual vocabulary
|
10 |
---
|
|
|
11 |
|
12 |
-
|
13 |
|
14 |
-
This dashboard
|
15 |
-
to
|
|
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
- [Huong Li Nguyen](https://github.com/huong-li-nguyen) and [Antony Milne](https://github.com/antonymilne)
|
20 |
|
21 |
- Images created by QuantumBlack
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
24 |
|
25 |
-
- [The
|
26 |
-
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
|
32 |
-
- [
|
33 |
-
- [Guide to data chart mastery](https://www.atlassian.com/data/charts)
|
34 |
|
35 |
## Chart types
|
36 |
|
|
|
8 |
license: apache-2.0
|
9 |
short_description: Vizro - Visual vocabulary
|
10 |
---
|
11 |
+
# Vizro visual vocabulary
|
12 |
|
13 |
+
### Welcome to our visual vocabulary dashboard! 🎨
|
14 |
|
15 |
+
This dashboard serves as a comprehensive guide for selecting and creating various types of charts. It helps you decide
|
16 |
+
when to use each chart type, and offers sample Python code using [Plotly](https://plotly.com/python/), and
|
17 |
+
instructions for embedding these charts into a [Vizro](https://github.com/mckinsey/vizro) dashboard.
|
18 |
|
19 |
+
The charts in this dashboard are designed to make it easy for anyone to create beautiful and sophisticated visuals.
|
20 |
+
|
21 |
+
Our goal is to help you understand best practices in data visualization, ensure your charts effectively communicate
|
22 |
+
your message, and streamline the creation of high-quality, interactive visualizations.
|
23 |
+
|
24 |
+
Created by:
|
25 |
|
26 |
- [Huong Li Nguyen](https://github.com/huong-li-nguyen) and [Antony Milne](https://github.com/antonymilne)
|
27 |
|
28 |
- Images created by QuantumBlack
|
29 |
|
30 |
+
Inspired by:
|
31 |
+
|
32 |
+
- [The FT Visual Vocabulary](https://github.com/Financial-Times/chart-doctor/blob/main/visual-vocabulary/README.md):
|
33 |
+
[Alan Smith](https://github.com/alansmithy), [Chris Campbell](https://github.com/digitalcampbell), Ian Bott,
|
34 |
+
Liz Faunce, Graham Parrish, Billy Ehrenberg, Paul McCallum, [Martin Stabe](https://github.com/martinstabe).
|
35 |
|
36 |
+
- [The Graphic Continuum](https://www.informationisbeautifulawards.com/showcase/611-the-graphic-continuum):
|
37 |
+
Jon Swabish and Severino Ribecca
|
38 |
|
39 |
+
Credits and sources:
|
40 |
|
41 |
+
- Charting library: [Plotly](https://plotly.com/python/plotly-express/)
|
42 |
|
43 |
+
- Data visualization best practices: [Guide to data chart mastery](https://www.atlassian.com/data/charts)
|
|
|
44 |
|
45 |
## Chart types
|
46 |
|
app.py
CHANGED
@@ -95,7 +95,7 @@ homepage = vm.Page(
|
|
95 |
# work nicely with the hierarchical navigation.
|
96 |
dashboard = vm.Dashboard(
|
97 |
# ALL_CHART_GROUP.pages has duplicated pages, e.g. both distribution-butterfly and deviation-butterfly.
|
98 |
-
title="Vizro
|
99 |
pages=[homepage, *ALL_CHART_GROUP.pages],
|
100 |
navigation=vm.Navigation(
|
101 |
nav_selector=vm.NavBar(
|
|
|
95 |
# work nicely with the hierarchical navigation.
|
96 |
dashboard = vm.Dashboard(
|
97 |
# ALL_CHART_GROUP.pages has duplicated pages, e.g. both distribution-butterfly and deviation-butterfly.
|
98 |
+
title="Vizro visual vocabulary",
|
99 |
pages=[homepage, *ALL_CHART_GROUP.pages],
|
100 |
navigation=vm.Navigation(
|
101 |
nav_selector=vm.NavBar(
|
assets/css/custom.css
CHANGED
@@ -64,8 +64,15 @@ img[src*="#chart-icon"] {
|
|
64 |
padding: 4px 12px;
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
67 |
.intro-text p {
|
68 |
-
font-size:
|
69 |
-
line-height: 20px;
|
70 |
margin: 0;
|
71 |
}
|
|
|
|
|
|
|
|
|
|
64 |
padding: 4px 12px;
|
65 |
}
|
66 |
|
67 |
+
.intro-text h4 {
|
68 |
+
color: var(--text-secondary);
|
69 |
+
}
|
70 |
+
|
71 |
.intro-text p {
|
72 |
+
font-size: 12px;
|
|
|
73 |
margin: 0;
|
74 |
}
|
75 |
+
|
76 |
+
.intro-text p a {
|
77 |
+
font-size: inherit;
|
78 |
+
}
|
chart_groups.py
CHANGED
@@ -43,9 +43,9 @@ class ChartGroup:
|
|
43 |
|
44 |
|
45 |
deviation_intro_text = """
|
46 |
-
Deviation enables you to draw attention to variations (+/-) from a fixed reference point.
|
47 |
-
|
48 |
-
|
49 |
"""
|
50 |
deviation_chart_group = ChartGroup(
|
51 |
name="Deviation",
|
@@ -61,25 +61,22 @@ deviation_chart_group = ChartGroup(
|
|
61 |
|
62 |
|
63 |
correlation_intro_text = """
|
64 |
-
Correlation helps you show the relationship between two or more variables. It is important that you
|
65 |
-
|
66 |
-
other.
|
67 |
"""
|
68 |
correlation_chart_group = ChartGroup(
|
69 |
name="Correlation",
|
70 |
pages=pages.correlation.pages,
|
71 |
-
incomplete_pages=[
|
72 |
-
IncompletePage("Heatmap matrix"),
|
73 |
-
],
|
74 |
icon="Bubble Chart",
|
75 |
intro_text=correlation_intro_text,
|
76 |
)
|
77 |
|
78 |
|
79 |
ranking_intro_text = """
|
80 |
-
Ranking enables you to present items in an ordered list. Use this when you want to highlight the
|
81 |
-
|
82 |
-
|
83 |
"""
|
84 |
ranking_chart_group = ChartGroup(
|
85 |
name="Ranking",
|
@@ -96,11 +93,10 @@ ranking_chart_group = ChartGroup(
|
|
96 |
|
97 |
|
98 |
distribution_intro_text = """
|
99 |
-
Distribution helps you to present all the possible values (or intervals) of your data and how often they
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
uniformity or equality in the data.
|
104 |
"""
|
105 |
distribution_chart_group = ChartGroup(
|
106 |
name="Distribution",
|
@@ -116,10 +112,9 @@ distribution_chart_group = ChartGroup(
|
|
116 |
)
|
117 |
|
118 |
magnitude_intro_text = """
|
119 |
-
Magnitude allows you to emphasize size comparisons of **counted** items in your data set. You can show
|
120 |
-
|
121 |
-
|
122 |
-
percentages.
|
123 |
"""
|
124 |
magnitude_chart_group = ChartGroup(
|
125 |
name="Magnitude",
|
@@ -137,9 +132,9 @@ magnitude_chart_group = ChartGroup(
|
|
137 |
)
|
138 |
|
139 |
time_intro_text = """
|
140 |
-
Time helps you draw attention to important trends emerging over a specified period. The time period you
|
141 |
-
|
142 |
-
|
143 |
"""
|
144 |
time_chart_group = ChartGroup(
|
145 |
name="Time",
|
@@ -157,8 +152,8 @@ time_chart_group = ChartGroup(
|
|
157 |
|
158 |
|
159 |
part_to_whole_intro_text = """
|
160 |
-
Part-to-whole helps you show how one whole item breaks down into its component parts. If you consider the
|
161 |
-
|
162 |
"""
|
163 |
part_to_whole_chart_group = ChartGroup(
|
164 |
name="Part-to-whole",
|
@@ -175,9 +170,8 @@ part_to_whole_chart_group = ChartGroup(
|
|
175 |
)
|
176 |
|
177 |
flow_intro_text = """
|
178 |
-
With flow charts, you can highlight the quantity or the intensity of the movement between more than one
|
179 |
-
|
180 |
-
locations.
|
181 |
"""
|
182 |
flow_chart_group = ChartGroup(
|
183 |
name="Flow",
|
@@ -192,14 +186,12 @@ flow_chart_group = ChartGroup(
|
|
192 |
)
|
193 |
|
194 |
spatial_intro_text = """
|
195 |
-
Spatial charts allow you to demonstrate precise locations or geographical patterns in your data.
|
196 |
"""
|
197 |
spatial_chart_group = ChartGroup(
|
198 |
name="Spatial",
|
199 |
pages=pages.spatial.pages,
|
200 |
-
incomplete_pages=[
|
201 |
-
IncompletePage("Flow map"),
|
202 |
-
],
|
203 |
icon="Map",
|
204 |
intro_text=spatial_intro_text,
|
205 |
)
|
@@ -218,33 +210,38 @@ CHART_GROUPS = [
|
|
218 |
]
|
219 |
|
220 |
all_intro_text = """
|
221 |
-
This dashboard shows a gallery of charts. It includes guidance on when to use each chart type and sample Python code
|
222 |
-
to create them using [Plotly](https://plotly.com/python/) and [Vizro](https://github.com/mckinsey/vizro).
|
223 |
|
224 |
-
|
225 |
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
|
228 |
|
229 |
|
230 |
-
|
|
|
231 |
- [Huong Li Nguyen](https://github.com/huong-li-nguyen) and [Antony Milne](https://github.com/antonymilne)
|
232 |
|
233 |
- Images created by QuantumBlack
|
234 |
|
235 |
-
|
236 |
- [The FT Visual Vocabulary](https://github.com/Financial-Times/chart-doctor/blob/main/visual-vocabulary/README.md):
|
237 |
-
Alan Smith, Chris Campbell, Ian Bott,
|
|
|
238 |
|
239 |
- [The Graphic Continuum](https://www.informationisbeautifulawards.com/showcase/611-the-graphic-continuum):
|
240 |
Jon Swabish and Severino Ribecca
|
241 |
|
242 |
-
|
243 |
-
|
244 |
-
**Credits and sources:**
|
245 |
|
246 |
-
- [
|
247 |
-
- [Guide to data chart mastery](https://www.atlassian.com/data/charts)
|
248 |
|
249 |
"""
|
250 |
|
|
|
43 |
|
44 |
|
45 |
deviation_intro_text = """
|
46 |
+
#### Deviation enables you to draw attention to variations (+/-) from a fixed reference point. Often this reference \
|
47 |
+
point is zero, but you might also show a target or a long term average. You can also use deviation to express a \
|
48 |
+
positive, neutral or negative sentiment.
|
49 |
"""
|
50 |
deviation_chart_group = ChartGroup(
|
51 |
name="Deviation",
|
|
|
61 |
|
62 |
|
63 |
correlation_intro_text = """
|
64 |
+
#### Correlation helps you show the relationship between two or more variables. It is important that you make it clear\
|
65 |
+
to your audience whether or not the relationship is causal, i.e., whether one causes the other.
|
|
|
66 |
"""
|
67 |
correlation_chart_group = ChartGroup(
|
68 |
name="Correlation",
|
69 |
pages=pages.correlation.pages,
|
70 |
+
incomplete_pages=[IncompletePage("Heatmap matrix")],
|
|
|
|
|
71 |
icon="Bubble Chart",
|
72 |
intro_text=correlation_intro_text,
|
73 |
)
|
74 |
|
75 |
|
76 |
ranking_intro_text = """
|
77 |
+
#### Ranking enables you to present items in an ordered list. Use this when you want to highlight the position of an \
|
78 |
+
item rather than its absolute or relative value. You might want to emphasize the most interesting points with \
|
79 |
+
highlighting or labels to ensure the reader understands what matters most.
|
80 |
"""
|
81 |
ranking_chart_group = ChartGroup(
|
82 |
name="Ranking",
|
|
|
93 |
|
94 |
|
95 |
distribution_intro_text = """
|
96 |
+
#### Distribution helps you to present all the possible values (or intervals) of your data and how often they occur. \
|
97 |
+
You can organize the data to show the number or percentage of items in a specified group, what shape the group takes,\
|
98 |
+
where the center lies, and how much variability there is in the data. This shape (or _skew_) of a distribution can be \
|
99 |
+
a powerful way for you to highlight either the existence or lack of uniformity or equality in the data.
|
|
|
100 |
"""
|
101 |
distribution_chart_group = ChartGroup(
|
102 |
name="Distribution",
|
|
|
112 |
)
|
113 |
|
114 |
magnitude_intro_text = """
|
115 |
+
#### Magnitude allows you to emphasize size comparisons of **counted** items in your data set. You can show relative \
|
116 |
+
comparisons (whether something is larger or smaller) or absolute differences (where the nuances are most interesting). \
|
117 |
+
Typically, you will use magnitude for actual numbers versus calculated rates or percentages.
|
|
|
118 |
"""
|
119 |
magnitude_chart_group = ChartGroup(
|
120 |
name="Magnitude",
|
|
|
132 |
)
|
133 |
|
134 |
time_intro_text = """
|
135 |
+
#### Time helps you draw attention to important trends emerging over a specified period. The time period you select \
|
136 |
+
could be as short as seconds or as long as centuries. What matters most is selecting the correct period of time to \
|
137 |
+
best show your audience the message they need to take away.
|
138 |
"""
|
139 |
time_chart_group = ChartGroup(
|
140 |
name="Time",
|
|
|
152 |
|
153 |
|
154 |
part_to_whole_intro_text = """
|
155 |
+
#### Part-to-whole helps you show how one whole item breaks down into its component parts. If you consider the size of\
|
156 |
+
the parts to be most important, a magnitude chart may be more appropriate.
|
157 |
"""
|
158 |
part_to_whole_chart_group = ChartGroup(
|
159 |
name="Part-to-whole",
|
|
|
170 |
)
|
171 |
|
172 |
flow_intro_text = """
|
173 |
+
#### With flow charts, you can highlight the quantity or the intensity of the movement between more than one state or \
|
174 |
+
condition. The flow might be steps in a logical sequence or movement between different geographical locations.
|
|
|
175 |
"""
|
176 |
flow_chart_group = ChartGroup(
|
177 |
name="Flow",
|
|
|
186 |
)
|
187 |
|
188 |
spatial_intro_text = """
|
189 |
+
#### Spatial charts allow you to demonstrate precise locations or geographical patterns in your data.
|
190 |
"""
|
191 |
spatial_chart_group = ChartGroup(
|
192 |
name="Spatial",
|
193 |
pages=pages.spatial.pages,
|
194 |
+
incomplete_pages=[IncompletePage("Flow map")],
|
|
|
|
|
195 |
icon="Map",
|
196 |
intro_text=spatial_intro_text,
|
197 |
)
|
|
|
210 |
]
|
211 |
|
212 |
all_intro_text = """
|
|
|
|
|
213 |
|
214 |
+
### Welcome to our visual vocabulary dashboard! 🎨
|
215 |
|
216 |
+
#### This dashboard serves as a comprehensive guide for selecting and creating various types of charts. It helps \
|
217 |
+
you decide when to use each chart type, and offers sample Python code using [Plotly](https://plotly.com/python/), \
|
218 |
+
and instructions for embedding these charts into a [Vizro](https://github.com/mckinsey/vizro) dashboard.
|
219 |
+
|
220 |
+
#### The charts in this dashboard are designed to make it easy for anyone to create beautiful and sophisticated visuals.
|
221 |
+
|
222 |
+
#### Our goal is to help you understand best practices in data visualization, ensure your charts effectively \
|
223 |
+
communicate your message, and streamline the creation of high-quality, interactive visualizations.
|
224 |
|
225 |
|
226 |
|
227 |
+
|
228 |
+
Created by:
|
229 |
- [Huong Li Nguyen](https://github.com/huong-li-nguyen) and [Antony Milne](https://github.com/antonymilne)
|
230 |
|
231 |
- Images created by QuantumBlack
|
232 |
|
233 |
+
Inspired by:
|
234 |
- [The FT Visual Vocabulary](https://github.com/Financial-Times/chart-doctor/blob/main/visual-vocabulary/README.md):
|
235 |
+
[Alan Smith](https://github.com/alansmithy), [Chris Campbell](https://github.com/digitalcampbell), Ian Bott,
|
236 |
+
Liz Faunce, Graham Parrish, Billy Ehrenberg, Paul McCallum, [Martin Stabe](https://github.com/martinstabe).
|
237 |
|
238 |
- [The Graphic Continuum](https://www.informationisbeautifulawards.com/showcase/611-the-graphic-continuum):
|
239 |
Jon Swabish and Severino Ribecca
|
240 |
|
241 |
+
Credits and sources:
|
242 |
+
- Charting library: [Plotly](https://plotly.com/python/plotly-express/)
|
|
|
243 |
|
244 |
+
- Data visualization best practices: [Guide to data chart mastery](https://www.atlassian.com/data/charts)
|
|
|
245 |
|
246 |
"""
|
247 |
|
requirements.in
CHANGED
@@ -2,5 +2,5 @@
|
|
2 |
# It should be fully generated and used when the demo moves to huggingface.
|
3 |
black==24.4.2
|
4 |
plotly>=5.24.0
|
5 |
-
vizro
|
6 |
gunicorn
|
|
|
2 |
# It should be fully generated and used when the demo moves to huggingface.
|
3 |
black==24.4.2
|
4 |
plotly>=5.24.0
|
5 |
+
vizro==0.1.22
|
6 |
gunicorn
|
requirements.txt
CHANGED
@@ -110,7 +110,7 @@ tzdata==2024.1
|
|
110 |
# via pandas
|
111 |
urllib3==2.2.2
|
112 |
# via requests
|
113 |
-
vizro==0.1.
|
114 |
# via -r requirements.in
|
115 |
werkzeug==3.0.4
|
116 |
# via
|
|
|
110 |
# via pandas
|
111 |
urllib3==2.2.2
|
112 |
# via requests
|
113 |
+
vizro==0.1.22
|
114 |
# via -r requirements.in
|
115 |
werkzeug==3.0.4
|
116 |
# via
|