Skip to content

Commit 058eed2

Browse files
authored
Merge pull request #5171 from plotly/updates-for-main
Merge recent docs changes back to main
2 parents f70d8bf + 04203fa commit 058eed2

File tree

4 files changed

+148
-12
lines changed

4 files changed

+148
-12
lines changed

.circleci/config.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ commands:
5858
source .venv/bin/activate
5959
uv pip install .
6060
uv pip install -r ./test_requirements/requirements_optional.txt
61-
61+
6262
- when:
63-
condition:
63+
condition:
6464
not:
6565
equal:
6666
- <<parameters.pandas_version>>
@@ -347,6 +347,8 @@ jobs:
347347
name: Install dependencies
348348
command: |
349349
cd doc
350+
sudo apt-get update
351+
sudo apt-get install rename
350352
curl -LsSf https://astral.sh/uv/install.sh | sh
351353
uv venv
352354
source .venv/bin/activate

doc/python/bar-charts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ import plotly.express as px
124124
df = px.data.gapminder().query("continent == 'Oceania'")
125125
fig = px.bar(df, x='year', y='pop',
126126
hover_data=['lifeExp', 'gdpPercap'], color='country',
127-
labels={'pop':'population of Canada'}, height=400)
127+
labels={'pop':'population of Oceania'}, height=400)
128128
fig.show()
129129
```
130130

doc/python/supported-colors.md

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
jupyter:
3+
jupytext:
4+
notebook_metadata_filter: all
5+
text_representation:
6+
extension: .md
7+
format_name: markdown
8+
format_version: '1.3'
9+
jupytext_version: 1.17.0
10+
kernelspec:
11+
display_name: Python 3 (ipykernel)
12+
language: python
13+
name: python3
14+
language_info:
15+
codemirror_mode:
16+
name: ipython
17+
version: 3
18+
file_extension: .py
19+
mimetype: text/x-python
20+
name: python
21+
nbconvert_exporter: python
22+
pygments_lexer: ipython3
23+
version: 3.13.2
24+
plotly:
25+
description: A list of supported named CSS Colors
26+
display_as: file_settings
27+
language: python
28+
layout: base
29+
name: Supported CSS Colors
30+
order: 41
31+
page_type: example_index
32+
permalink: python/css-colors/
33+
thumbnail: thumbnail/shape.jpg
34+
---
35+
36+
# Supported CSS Colors
37+
38+
Many properties in Plotly.py for configuring colors support named CSS colors. For example, marker colors:
39+
40+
```python
41+
import plotly.graph_objects as go
42+
43+
fig = go.Figure([
44+
go.Bar(
45+
x=['Jan', 'Feb', 'Mar', 'Apr'],
46+
y=[20, 14, 25, 16],
47+
name='Primary Product',
48+
# Named CSS color
49+
marker_color='royalblue'
50+
)
51+
])
52+
53+
fig.show()
54+
```
55+
56+
These colors are supported in Plotly.py when a property accepts a [named CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/named-color).
57+
58+
```python hide_code=true
59+
import plotly.graph_objects as go
60+
import pandas as pd
61+
62+
supported_colors = ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure",
63+
"beige", "bisque", "black", "blanchedalmond", "blue",
64+
"blueviolet", "brown", "burlywood", "cadetblue",
65+
"chartreuse", "chocolate", "coral", "cornflowerblue",
66+
"cornsilk", "crimson", "cyan", "darkblue", "darkcyan",
67+
"darkgoldenrod", "darkgray", "darkgrey", "darkgreen",
68+
"darkkhaki", "darkmagenta", "darkolivegreen", "darkorange",
69+
"darkorchid", "darkred", "darksalmon", "darkseagreen",
70+
"darkslateblue", "darkslategray", "darkslategrey",
71+
"darkturquoise", "darkviolet", "deeppink", "deepskyblue",
72+
"dimgray", "dimgrey", "dodgerblue", "firebrick",
73+
"floralwhite", "forestgreen", "fuchsia", "gainsboro",
74+
"ghostwhite", "gold", "goldenrod", "gray", "grey", "green",
75+
"greenyellow", "honeydew", "hotpink", "indianred", "indigo",
76+
"ivory", "khaki", "lavender", "lavenderblush", "lawngreen",
77+
"lemonchiffon", "lightblue", "lightcoral", "lightcyan",
78+
"lightgoldenrodyellow", "lightgray", "lightgrey",
79+
"lightgreen", "lightpink", "lightsalmon", "lightseagreen",
80+
"lightskyblue", "lightslategray", "lightslategrey",
81+
"lightsteelblue", "lightyellow", "lime", "limegreen",
82+
"linen", "magenta", "maroon", "mediumaquamarine",
83+
"mediumblue", "mediumorchid", "mediumpurple",
84+
"mediumseagreen", "mediumslateblue", "mediumspringgreen",
85+
"mediumturquoise", "mediumvioletred", "midnightblue",
86+
"mintcream", "mistyrose", "moccasin", "navajowhite", "navy",
87+
"oldlace", "olive", "olivedrab", "orange", "orangered",
88+
"orchid", "palegoldenrod", "palegreen", "paleturquoise",
89+
"palevioletred", "papayawhip", "peachpuff", "peru", "pink",
90+
"plum", "powderblue", "purple", "red", "rosybrown",
91+
"royalblue", "rebeccapurple", "saddlebrown", "salmon",
92+
"sandybrown", "seagreen", "seashell", "sienna", "silver",
93+
"skyblue", "slateblue", "slategray", "slategrey", "snow",
94+
"springgreen", "steelblue", "tan", "teal", "thistle", "tomato",
95+
"turquoise", "violet", "wheat", "white", "whitesmoke",
96+
"yellow", "yellowgreen"]
97+
98+
fig = go.Figure(layout=dict(title="Supported Named CSS Colors"))
99+
100+
for i, color in enumerate(supported_colors):
101+
row, col = i // 5, i % 5
102+
x0, y0 = col * 1.2, -row * 1.2
103+
104+
fig.add_shape(
105+
type="rect",
106+
x0=x0, y0=y0,
107+
x1=x0+1, y1=y0+1,
108+
fillcolor=color,
109+
line=dict(color="black", width=0.2),
110+
)
111+
112+
fig.add_annotation(
113+
x=x0+0.5, y=y0-0.1,
114+
text=color,
115+
showarrow=False,
116+
font=dict(size=10)
117+
)
118+
119+
fig.update_layout(
120+
height=((len(supported_colors) // 5) + (1 if len(supported_colors) % 5 else 0)) * 120,
121+
width=800,
122+
showlegend=False,
123+
plot_bgcolor='rgba(0,0,0,0)',
124+
margin=dict(l=50, r=50, t=50, b=50),
125+
xaxis=dict(
126+
showgrid=False,
127+
zeroline=False,
128+
showticklabels=False,
129+
range=[-0.5, 6]
130+
),
131+
yaxis=dict(
132+
showgrid=False,
133+
zeroline=False,
134+
showticklabels=False,
135+
scaleanchor="x",
136+
scaleratio=1,
137+
range=[-((len(supported_colors) // 5) + 1) * 1.2, 1.5]
138+
)
139+
)
140+
141+
fig.show()
142+
```

doc/python/tile-scatter-maps.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,6 @@ fig.show()
203203

204204
You can define the symbol on your map by setting [`symbol`](https://plotly.com/python/reference/scattermap/#scattermap-marker-symbol) attribute.
205205

206-
- basic
207-
- streets
208-
- outdoors
209-
- light
210-
- dark
211-
- satellite
212-
- satellite-streets
213-
214206
```python
215207
import plotly.graph_objects as go
216208

@@ -356,6 +348,6 @@ fig.show()
356348

357349
#### Reference
358350

359-
See [function reference for `px.scatter_map`](https://plotly.com/python-api-reference/generated/plotly.express.scatter_mapbox) or https://plotly.com/python/reference/scattermap/ for more information about the attributes available.
351+
See [function reference for `px.scatter_map`](https://plotly.com/python-api-reference/generated/plotly.express.scatter_map) or https://plotly.com/python/reference/scattermap/ for more information about the attributes available.
360352

361353
For Mapbox-based tile maps, see [function reference for `px.scatter_mapbox`](https://plotly.com/python-api-reference/generated/plotly.express.scatter_mapbox) or https://plotly.com/python/reference/scattermapbox/.

0 commit comments

Comments
 (0)