File size: 24,505 Bytes
27a0393
 
22b0b94
27a0393
22b0b94
27a0393
 
 
 
 
e777f08
76bf90c
27a0393
f5e87d9
42ee455
f5e87d9
 
 
42ee455
f5e87d9
 
 
 
 
 
42ee455
 
 
 
 
f5e87d9
 
 
 
 
42ee455
f5e87d9
 
42ee455
f5e87d9
42ee455
e777f08
 
f5e87d9
42ee455
 
 
 
 
e777f08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76bf90c
e777f08
42ee455
e777f08
 
42ee455
e777f08
42ee455
 
 
76bf90c
42ee455
 
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
---
title: Visual Vocabulary
emoji: 🎨
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: apache-2.0
short_description: Vizro - Visual vocabulary
---

# Visual vocabulary

### Welcome to our visual vocabulary dashboard! 🎨

This dashboard serves as a comprehensive guide for selecting and creating various types of charts. It helps you decide
when to use each chart type, and offers sample Python code using [Plotly](https://plotly.com/python/), and
instructions for embedding these charts into a [Vizro](https://github.com/mckinsey/vizro) dashboard.

The charts in this dashboard are designed to make it easy for anyone to create beautiful and sophisticated visuals.

Our goal is to help you understand best practices in data visualization, ensure your charts effectively communicate
your message, and streamline the creation of high-quality, interactive visualizations.

Created by:

- [Huong Li Nguyen](https://github.com/huong-li-nguyen) and [Antony Milne](https://github.com/antonymilne)

- Images created by QuantumBlack

Inspired by:

- [The FT Visual Vocabulary](https://github.com/Financial-Times/chart-doctor/blob/main/visual-vocabulary/README.md):
  [Alan Smith](https://github.com/alansmithy), [Chris Campbell](https://github.com/digitalcampbell), Ian Bott,
  Liz Faunce, Graham Parrish, Billy Ehrenberg, Paul McCallum, [Martin Stabe](https://github.com/martinstabe).

- [The Graphic Continuum](https://www.informationisbeautifulawards.com/showcase/611-the-graphic-continuum):
  Jon Swabish and Severino Ribecca

Credits and sources:

- Charting library: [Plotly](https://github.com/plotly/plotly.py)
- Plotly Express chart examples: [Plotly Express](https://plotly.com/python/plotly-express/)
- Data visualization best practices: [Guide to data chart mastery](https://www.atlassian.com/data/charts)

## Chart types

The dashboard is still in development. Below is an overview of the chart types for which a completed page is available.

| Chart Type            | Status | Category                 | Credits & sources                                                                          | API                                                                                                                                                                                             |
| --------------------- | ------ | ------------------------ | ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Arc                   | ❌     | Part-to-whole            |                                                                                            |                                                                                                                                                                                                 |
| Area                  | βœ…     | Time                     | [Filled area plot with px](https://plotly.com/python/filled-area-plots/)                   | [px.area](https://plotly.com/python-api-reference/generated/plotly.express.area)                                                                                                                |
| Bar                   | βœ…     | Magnitude                | [Bar chart with px](https://plotly.com/python/bar-charts/)                                 | [px.bar](https://plotly.com/python-api-reference/generated/plotly.express.bar)                                                                                                                  |
| Barcode               | ❌     | Distribution             |                                                                                            |                                                                                                                                                                                                 |
| Beeswarm              | ❌     | Distribution             |                                                                                            |                                                                                                                                                                                                 |
| Boxplot               | βœ…     | Distribution             | [Box plot with px](https://plotly.com/python/box-plots/)                                   | [px.box](https://plotly.github.io/plotly.py-docs/generated/plotly.express.box)                                                                                                                  |
| Bubble                | βœ…     | Correlation              | [Scatter plot with px](https://plotly.com/python/line-and-scatter/)                        | [px.scatter](https://plotly.com/python-api-reference/generated/plotly.express.scatter)                                                                                                          |
| Bubble map            | βœ…     | Spatial                  | [Bubble map in px](https://plotly.com/python/bubble-maps/)                                 | [px.scatter_map](https://plotly.github.io/plotly.py-docs/generated/plotly.express.scatter_map)                                                                                                  |
| Bubble timeline       | ❌     | Time                     |                                                                                            |                                                                                                                                                                                                 |
| Bullet                | ❌     | Magnitude                |                                                                                            |                                                                                                                                                                                                 |
| Bump                  | ❌     | Ranking                  |                                                                                            |                                                                                                                                                                                                 |
| Butterfly             | βœ…     | Deviation, Distribution  | [Pyramid charts in Plotly](https://plotly.com/python/v3/population-pyramid-charts/)        | [go.Bar](https://plotly.com/python-api-reference/generated/plotly.graph_objects.Bar.html)                                                                                                       |
| Chord                 | ❌     | Flow                     |                                                                                            |                                                                                                                                                                                                 |
| Choropleth            | βœ…     | Spatial                  | [Choropleth map with px](https://plotly.com/python/choropleth-maps/)                       | [px.choropleth](https://plotly.github.io/plotly.py-docs/generated/plotly.express.choropleth.html)                                                                                               |
| Column                | βœ…     | Magnitude, Time          | [Bar chart with px](https://plotly.com/python/bar-charts/)                                 | [px.bar](https://plotly.com/python-api-reference/generated/plotly.express.bar.html)                                                                                                             |
| Column and line       | βœ…     | Correlation, Time        | [Multiple chart types in Plotly](https://plotly.com/python/graphing-multiple-chart-types/) | [go.Bar](https://plotly.com/python-api-reference/generated/plotly.graph_objects.Bar.html) and [go.Scatter](https://plotly.com/python-api-reference/generated/plotly.graph_objects.Scatter.html) |
| Connected scatter     | βœ…     | Correlation, Time        | [Line plot with px](https://plotly.com/python/line-charts/)                                | [px.line](https://plotly.com/python-api-reference/generated/plotly.express.line)                                                                                                                |
| Cumulative curve      | ❌     | Distribution             |                                                                                            |                                                                                                                                                                                                 |
| Diverging bar         | ❌     | Deviation                |                                                                                            |                                                                                                                                                                                                 |
| Diverging stacked bar | ❌     | Deviation                |                                                                                            |                                                                                                                                                                                                 |
| Donut                 | βœ…     | Part-to-whole            | [Pie chart with px](https://plotly.com/python/pie-charts/)                                 | [px.pie](https://plotly.com/python-api-reference/generated/plotly.express.pie)                                                                                                                  |
| Dot map               | βœ…     | Spatial                  | [Bubble map in px](https://plotly.com/python/bubble-maps/)                                 | [px.scatter_map](https://plotly.github.io/plotly.py-docs/generated/plotly.express.scatter_map)                                                                                                  |
| Dot plot              | ❌     | Distribution             |                                                                                            |                                                                                                                                                                                                 |
| Fan                   | ❌     | Time                     |                                                                                            |                                                                                                                                                                                                 |
| Flow map              | ❌     | Spatial                  |                                                                                            |                                                                                                                                                                                                 |
| Funnel                | βœ…     | Part-to-whole            | [Funnel plot with px](https://plotly.com/python/funnel-charts/)                            | [px.funnel](https://plotly.com/python/funnel-charts/)                                                                                                                                           |
| Gantt                 | ❌     | Time                     |                                                                                            |                                                                                                                                                                                                 |
| Gridplot              | ❌     | Part-to-whole            |                                                                                            |                                                                                                                                                                                                 |
| Heatmap               | βœ…     | Time                     | [Heatmaps with px](https://plotly.com/python/heatmaps/)                                    | [px.density_heatmap](https://plotly.com/python-api-reference/generated/plotly.express.density_heatmap.html)                                                                                     |
| Correlation matrix    | ❌     | Correlation              |                                                                                            |                                                                                                                                                                                                 |
| Histogram             | βœ…     | Distribution             | [Histograms with px](https://plotly.com/python/histograms/)                                | [px.histogram](https://plotly.github.io/plotly.py-docs/generated/plotly.express.histogram)                                                                                                      |
| Line                  | βœ…     | Time                     | [Line plot with px](https://plotly.com/python/line-charts/)                                | [px.line](https://plotly.com/python-api-reference/generated/plotly.express.line)                                                                                                                |
| Lollipop              | ❌     | Ranking, Magnitude       |                                                                                            |                                                                                                                                                                                                 |
| Marimekko             | ❌     | Magnitude, Part-to-whole |                                                                                            |                                                                                                                                                                                                 |
| Network               | ❌     | Flow                     |                                                                                            |                                                                                                                                                                                                 |
| Ordered bar           | βœ…     | Ranking                  | [Bar chart with px](https://plotly.com/python/bar-charts/)                                 | [px.bar](https://plotly.com/python-api-reference/generated/plotly.express.bar.html)                                                                                                             |
| Ordered bubble        | ❌     | Ranking                  |                                                                                            |                                                                                                                                                                                                 |
| Ordered column        | βœ…     | Ranking                  | [Bar chart with px](https://plotly.com/python/bar-charts/)                                 | [px.bar](https://plotly.com/python-api-reference/generated/plotly.express.bar.html)                                                                                                             |
| Paired bar            | βœ…     | Magnitude                | [Histograms with px](https://plotly.com/python/histograms/)                                | [px.histogram](https://plotly.github.io/plotly.py-docs/generated/plotly.express.histogram)                                                                                                      |
| Paired column         | βœ…     | Magnitude                | [Histograms with px](https://plotly.com/python/histograms/)                                | [px.histogram](https://plotly.github.io/plotly.py-docs/generated/plotly.express.histogram)                                                                                                      |
| Parallel coordinates  | βœ…     | Magnitude                | [Parallel coordinates plot with px](https://plotly.com/python/parallel-coordinates-plot/)  | [px.parallel_coordinates](https://plotly.com/python-api-reference/generated/plotly.express.parallel_coordinates.html)                                                                           |
| Pictogram             | ❌     | Magnitude                |                                                                                            |                                                                                                                                                                                                 |
| Pie                   | βœ…     | Part-to-whole            | [Pie chart with px](https://plotly.com/python/pie-charts/)                                 | [px.pie](https://plotly.com/python-api-reference/generated/plotly.express.pie)                                                                                                                  |
| Radar                 | ❌     | Magnitude                |                                                                                            |                                                                                                                                                                                                 |
| Radial                | ❌     | Magnitude                |                                                                                            |                                                                                                                                                                                                 |
| Sankey                | βœ…     | Flow                     | [Sankey diagram in Plotly](https://plotly.com/python/sankey-diagram/)                      | [go.Sankey](https://plotly.github.io/plotly.py-docs/generated/plotly.graph_objects.Sankey.html)                                                                                                 |
| Scatter               | βœ…     | Correlation              | [Scatter plot with px](https://plotly.com/python/line-and-scatter/)                        | [px.scatter](https://plotly.com/python-api-reference/generated/plotly.express.scatter)                                                                                                          |
| Scatter matrix        | βœ…     | Correlation              | [Scatter matrix with px](https://plotly.com/python/splom/)                                 | [px.scatter_matrix](https://plotly.github.io/plotly.py-docs/generated/plotly.express.scatter_matrix.html)                                                                                       |
| Slope                 | ❌     | Ranking, Time            |                                                                                            |                                                                                                                                                                                                 |
| Sparkline             | ❌     | Time                     |                                                                                            |                                                                                                                                                                                                 |
| Stacked bar           | βœ…     | Part-to-whole            | [Histograms with px](https://plotly.com/python/histograms/)                                | [px.histogram](https://plotly.github.io/plotly.py-docs/generated/plotly.express.histogram)                                                                                                      |
| Stacked column        | βœ…     | Part-to-whole            | [Histograms with px](https://plotly.com/python/histograms/)                                | [px.histogram](https://plotly.github.io/plotly.py-docs/generated/plotly.express.histogram)                                                                                                      |
| Stepped line          | βœ…     | Time                     | [Line plot with px](https://plotly.com/python/line-charts/)                                | [px.line](https://plotly.com/python-api-reference/generated/plotly.express.line)                                                                                                                |
| Surplus deficit line  | ❌     | Deviation                |                                                                                            |                                                                                                                                                                                                 |
| Treemap               | βœ…     | Part-to-whole            | [Treemap with px](https://plotly.com/python/treemaps/)                                     | [px.treemap](https://plotly.com/python-api-reference/generated/plotly.express.treemap.html)                                                                                                     |
| Venn                  | ❌     | Part-to-whole            |                                                                                            |                                                                                                                                                                                                 |
| Violin                | βœ…     | Distribution             | [Violin plot with px](https://plotly.com/python/violin/)                                   | [px.violin](https://plotly.com/python-api-reference/generated/plotly.express.violin.html)                                                                                                       |
| Waterfall             | ❌     | Part-to-whole, Flow      |                                                                                            |                                                                                                                                                                                                 |

## How to contribute

Contributions are welcome! To contribute a chart, follow the steps below:

1. Check that a `svg` file named after the chart type is contained in the [assets](https://github.com/mckinsey/vizro/tree/main/vizro-core/examples/visual-vocabulary/assets/images/charts) folder. If not, [raise an issue](https://github.com/mckinsey/vizro/issues) in the repository.
2. Add the data set to `_pages_utils.py` if it doesn't already exist. Use existing data sets preferably or any other data set that is publicly available e.g. [plotlx.express.data](https://plotly.com/python-api-reference/generated/plotly.express.data.html)
3. Create a new page for the chart type and add it to the relevant category `.py` file such as `correlation.py`,
   `deviation.py`, `distribution.py`, etc. Ensure you add the page to the list of `pages` at the end of the `.py` file.
4. Add a `.py` file containing a code example of the chart type in the `pages/examples` folder, for instance, `area.py`. Take a look at existing examples.
5. Remove the `IncompletePage(..)` entry for that chart type in `chart_groups.py`.
6. Update this `README.md` with the new chart type, its status, category, and API links.

## How to run the example locally

1. If you have `hatch` set up, run the example with the command `hatch run example visual-vocabulary`.
   Otherwise, with a virtual Python environment activated, run `pip install -r requirements.txt` and then `python app.py`.
2. You should now be able to access the app locally via http://127.0.0.1:8050/.