You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/builtin-colorscales.md
+26-13
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ jupyter:
5
5
text_representation:
6
6
extension: .md
7
7
format_name: markdown
8
-
format_version: '1.2'
8
+
format_version: "1.2"
9
9
jupytext_version: 1.3.1
10
10
kernelspec:
11
11
display_name: Python 3
@@ -22,34 +22,39 @@ jupyter:
22
22
pygments_lexer: ipython3
23
23
version: 3.6.8
24
24
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.
27
28
display_as: file_settings
28
29
has_thumbnail: true
29
30
ipynb: ~notebook_demo/187
30
31
language: python
31
32
layout: base
32
-
name: Built-in Continuous Colorscales
33
+
name: Built-in Continuous Color Scales
33
34
order: 27
34
35
permalink: python/builtin-colorscales/
35
36
thumbnail: thumbnail/heatmap_colorscale.jpg
36
37
v4upgrade: true
37
38
---
38
39
39
-
### Using Built-In Colorscales
40
+
### Using Built-In Continuous Color Scales
40
41
41
42
Many Plotly Express functions accept a `color_continuous_scale` argument and many trace
42
43
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,
44
45
either by name in a case-insensitive string e.g. `px.scatter(continuous_color_scale="Viridis"`) or by reference e.g.
45
46
`go.Scatter(marker_colorscale=plotly.colors.sequential.Viridis)`. They can also be reversed by adding `_r` at the end
46
47
e.g. `"Viridis_r"` or `plotly.colors.sequential.Viridis_r`.
47
48
48
49
The `plotly.colours` module is also available under `plotly.express.colors` so you can refer to it as `px.colors`.
49
50
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/).
51
52
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
53
58
54
59
You can use any of the following names as string values to set `continuous_color_scale` or `colorscale` arguments.
55
60
These strings are case-insensitive and you can append `_r` to them to reverse the order of the scale.
print("\n".join(wrap("".join('{:<12}'.format(c) for c in named_colorscales), 96)))
63
68
```
64
69
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
66
79
67
80
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).
68
81
@@ -78,9 +91,9 @@ fig.show()
78
91
Note: `RdBu` was included in this module by mistake, even though it is a diverging color scale.
79
92
It is intentionally left in for backwards-compatibility reasons.
80
93
81
-
### Built-In Diverging Colorscales
94
+
### Built-In Diverging Color scales
82
95
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.
84
97
Diverging color scales are appropriate for continuous data that has a natural midpoint
85
98
other otherwise informative special value, such as 0 altitude, or the boiling point
86
99
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).
0 commit comments