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/marker-style.md
+83-2Lines changed: 83 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ jupyter:
8
8
format_version: '1.3'
9
9
jupytext_version: 1.14.1
10
10
kernelspec:
11
-
display_name: Python 3
11
+
display_name: Python 3 (ipykernel)
12
12
language: python
13
13
name: python3
14
14
language_info:
@@ -20,7 +20,7 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.8.8
23
+
version: 3.8.0
24
24
plotly:
25
25
description: How to style markers in Python with Plotly.
26
26
display_as: file_settings
@@ -332,6 +332,8 @@ Each basic symbol is also represented by a number. Adding 100 to that number is
332
332
333
333
In the following figure, hover over a symbol to see its name or number. Set the `marker_symbol` attribute equal to that name or number to change the marker symbol in your figure.
334
334
335
+
> The `arrow-wide` and `arrow` marker symbols are new in 5.11
336
+
335
337
```python
336
338
import plotly.graph_objects as go
337
339
from plotly.validators.scatter.marker import SymbolValidator
@@ -357,6 +359,85 @@ fig.show()
357
359
```
358
360
359
361
362
+
### Using a Custom Marker
363
+
364
+
To use a custom marker, set the `symbol` on the `marker`. Here we set it to `diamond`.
In the previous example the angle reference is the default `up`, which
410
+
means all makers start at the angle reference point of 0. Set `angleref` to `previous` and a marker will take its angle reference from the previous data point.
411
+
412
+
```python
413
+
import pandas as pd
414
+
import plotly.express as px
415
+
import plotly.graph_objects as go
416
+
417
+
418
+
df = px.data.gapminder()
419
+
420
+
fig = go.Figure()
421
+
422
+
for x in df.loc[df.continent.isin(["Europe"])].country.unique()[:5]:
423
+
fil = df.loc[(df.country.str.contains(x))]
424
+
fig.add_trace(
425
+
go.Scatter(
426
+
x=fil["year"],
427
+
y=fil["pop"],
428
+
mode="lines+markers",
429
+
marker=dict(
430
+
symbol="arrow",
431
+
size=15,
432
+
angleref="previous",
433
+
),
434
+
name=x,
435
+
)
436
+
)
437
+
fig.show()
438
+
439
+
```
440
+
360
441
### Reference
361
442
362
443
See https://plotly.com/python/reference/ for more information and chart attribute options!
0 commit comments