Skip to content

Commit 46dea5d

Browse files
Merge pull request #2890 from plotly/add-discrete-colors
Add Dash Snippet to discrete-color
2 parents 0178a84 + 9b545ea commit 46dea5d

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

doc/python/discrete-color.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.2'
9-
jupytext_version: 1.4.2
9+
jupytext_version: 1.6.0
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.7.7
23+
version: 3.7.6
2424
plotly:
2525
description: How to use and configure discrete color sequences, also known as
2626
categorical or qualitative color scales.
@@ -99,6 +99,20 @@ fig = px.scatter(df, x="total_bill", y="tip", color="size",
9999
fig.show()
100100
```
101101

102+
### Discrete Colors in Dash
103+
104+
[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. With Dash, you can add radio buttons to control the color mode of your graph.
105+
106+
To run the app below, run `pip install dash`, click "Download" to get the code and run `python app.py`.
107+
108+
Get started now with [the official docs](https://dash.plotly.com/installation) and learn how you can effortlessly [style](https://plotly.com/dash/design-kit/) and [deploy](https://plotly.com/dash/app-manager/) apps like this with [Dash Enterprise](https://plotly.com/dash/).
109+
110+
```python
111+
from IPython.display import IFrame
112+
snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/'
113+
IFrame(snippet_url + 'discrete-color', width='100%', height=630)
114+
```
115+
102116
### Color Sequences in Plotly Express
103117

104118
By default, Plotly Express will use the color sequence from the active [template](/python/templates/)'s `layout.colorway` attribute, and the default active template is `plotly` which uses the `plotly` color sequence. You can choose any of the following built-in qualitative color sequences from the `px.colors.qualitative` module, however, or define your own.
@@ -240,4 +254,4 @@ This works because just like in `px.colors.qualitative`, all [built-in continuou
240254
import plotly.express as px
241255

242256
print(px.colors.sequential.Plasma)
243-
```
257+
```

0 commit comments

Comments
 (0)