Skip to content

Add clarification on colors with open markers #4485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions doc/python/marker-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jupyter:
extension: .md
format_name: markdown
format_version: '1.3'
jupytext_version: 1.14.1
jupytext_version: 1.14.6
kernelspec:
display_name: Python 3 (ipykernel)
language: python
Expand All @@ -20,7 +20,7 @@ jupyter:
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.8.0
version: 3.10.11
plotly:
description: How to style markers in Python with Plotly.
display_as: file_settings
Expand Down Expand Up @@ -361,7 +361,7 @@ fig.show()

### Using a Custom Marker

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


```python
Expand All @@ -378,6 +378,31 @@ fig.show()

```

#### Open Marker Colors

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.

```python
import plotly.express as px

df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")

fig.update_traces(
marker=dict(
size=8,
symbol="diamond-open",
line=dict(
width=2,
# color="DarkSlateGrey" Line colors don't apply to open markers
)
),
selector=dict(mode="markers"),
)

fig.show()
```

### Setting Marker Angles


Expand Down