Skip to content

Commit f5bc9b1

Browse files
authored
Merge pull request #4485 from plotly/update-marker-docs
Add clarification on colors with open markers
2 parents f6365c4 + 5432c58 commit f5bc9b1

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

Diff for: doc/python/marker-style.md

+28-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.14.1
9+
jupytext_version: 1.14.6
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.8.0
23+
version: 3.10.11
2424
plotly:
2525
description: How to style markers in Python with Plotly.
2626
display_as: file_settings
@@ -361,7 +361,7 @@ fig.show()
361361

362362
### Using a Custom Marker
363363

364-
To use a custom marker, set the `symbol` on the `marker`. Here we set it to `diamond`.
364+
To use a custom marker, set the `symbol` on the `marker`. Here we set it to `diamond`.
365365

366366

367367
```python
@@ -378,6 +378,31 @@ fig.show()
378378

379379
```
380380

381+
#### Open Marker Colors
382+
383+
In the previous example, each marker has two colors, a marker color (set in Plotly Express with `color="species"`) and a line color (set on the line with `color="DarkSlateGrey"`. All open markers, like "diamond-open" in the following example, have a transparent fill, which means you can specify only one color. Specify this color using the marker color parameter. This controls the outline color and any dot or cross. For open markers, the line color does nothing.
384+
385+
```python
386+
import plotly.express as px
387+
388+
df = px.data.iris()
389+
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")
390+
391+
fig.update_traces(
392+
marker=dict(
393+
size=8,
394+
symbol="diamond-open",
395+
line=dict(
396+
width=2,
397+
# color="DarkSlateGrey" Line colors don't apply to open markers
398+
)
399+
),
400+
selector=dict(mode="markers"),
401+
)
402+
403+
fig.show()
404+
```
405+
381406
### Setting Marker Angles
382407

383408

0 commit comments

Comments
 (0)