Skip to content

Commit 277b9c9

Browse files
Merge pull request #2030 from plotly/colordocs
Color docs
2 parents 046040c + e9117dd commit 277b9c9

File tree

3 files changed

+480
-40
lines changed

3 files changed

+480
-40
lines changed

Diff for: doc/python/builtin-colorscales.md

+26-13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
8+
format_version: "1.2"
99
jupytext_version: 1.3.1
1010
kernelspec:
1111
display_name: Python 3
@@ -22,34 +22,39 @@ jupyter:
2222
pygments_lexer: ipython3
2323
version: 3.6.8
2424
plotly:
25-
description: A reference for the built-in named continuous (sequential, diverging
26-
and cylclical) colorscales in Plotly.
25+
description:
26+
A reference for the built-in named continuous (sequential, diverging
27+
and cylclical) color scales in Plotly.
2728
display_as: file_settings
2829
has_thumbnail: true
2930
ipynb: ~notebook_demo/187
3031
language: python
3132
layout: base
32-
name: Built-in Continuous Colorscales
33+
name: Built-in Continuous Color Scales
3334
order: 27
3435
permalink: python/builtin-colorscales/
3536
thumbnail: thumbnail/heatmap_colorscale.jpg
3637
v4upgrade: true
3738
---
3839

39-
### Using Built-In Colorscales
40+
### Using Built-In Continuous Color Scales
4041

4142
Many Plotly Express functions accept a `color_continuous_scale` argument and many trace
4243
types have a `colorscale` attribute in their schema. Plotly comes with a large number of
43-
built-in continuous colorscales, which can be referred to in Python code when setting the above arguments,
44+
built-in continuous color scales, which can be referred to in Python code when setting the above arguments,
4445
either by name in a case-insensitive string e.g. `px.scatter(continuous_color_scale="Viridis"`) or by reference e.g.
4546
`go.Scatter(marker_colorscale=plotly.colors.sequential.Viridis)`. They can also be reversed by adding `_r` at the end
4647
e.g. `"Viridis_r"` or `plotly.colors.sequential.Viridis_r`.
4748

4849
The `plotly.colours` module is also available under `plotly.express.colors` so you can refer to it as `px.colors`.
4950

50-
When using continuous colorscales, you will often want to [configure various aspects of its range and colorbar](/python/colorscales/).
51+
When using continuous color scales, you will often want to [configure various aspects of its range and colorbar](/python/colorscales/).
5152

52-
### Named Built-In Colorscales
53+
### Discrete Color Sequences
54+
55+
Plotly also comes with some built-in [discrete color sequences](/python/discrete-color/) which are _not intended_ to be used with the `color_continuous_scale` argument as they are not designed for interpolation to occur between adjacent colors.
56+
57+
### Named Built-In Continuous Color Scales
5358

5459
You can use any of the following names as string values to set `continuous_color_scale` or `colorscale` arguments.
5560
These strings are case-insensitive and you can append `_r` to them to reverse the order of the scale.
@@ -62,7 +67,15 @@ named_colorscales = px.colors.named_colorscales()
6267
print("\n".join(wrap("".join('{:<12}'.format(c) for c in named_colorscales), 96)))
6368
```
6469

65-
### Built-In Sequential Colorscales
70+
Built-in color scales are stored as lists of CSS colors:
71+
72+
```python
73+
import plotly.express as px
74+
75+
print(px.colors.sequential.Plasma)
76+
```
77+
78+
### Built-In Sequential Color scales
6679

6780
A collection of predefined sequential colorscales is provided in the `plotly.colors.sequential` module. Sequential color scales are appropriate for most continuous data, but in some cases it can be helpful to use a diverging or cyclical color scale (see below).
6881

@@ -78,9 +91,9 @@ fig.show()
7891
Note: `RdBu` was included in this module by mistake, even though it is a diverging color scale.
7992
It is intentionally left in for backwards-compatibility reasons.
8093

81-
### Built-In Diverging Colorscales
94+
### Built-In Diverging Color scales
8295

83-
A collection of predefined diverging colorscales is provided in the `plotly.colors.diverging` module.
96+
A collection of predefined diverging color scales is provided in the `plotly.colors.diverging` module.
8497
Diverging color scales are appropriate for continuous data that has a natural midpoint
8598
other otherwise informative special value, such as 0 altitude, or the boiling point
8699
of a liquid. These scales are intended to be used when [explicitly setting the midpoint of the scale](/python/colorscales/#setting-the-midpoint-of-a-diverging-colorscale).
@@ -94,9 +107,9 @@ fig = px.colors.diverging.swatches()
94107
fig.show()
95108
```
96109

97-
### Built-In Cyclical Colorscales
110+
### Built-In Cyclical Color scales
98111

99-
A collection of predefined cyclical colorscales is provided in the `plotly.colors.cyclical` module.
112+
A collection of predefined cyclical color scales is provided in the `plotly.colors.cyclical` module.
100113
Cyclical color scales are appropriate for continuous data that has a natural cyclical
101114
structure, such as temporal data (hour of day, day of week, day of year, seasons) or
102115
complex numbers or other phase or angular data.

0 commit comments

Comments
 (0)