55 text_representation :
66 extension : .md
77 format_name : markdown
8- format_version : " 1.1 "
9- jupytext_version : 1.1.7
8+ format_version : ' 1.2 '
9+ jupytext_version : 1.3.2
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.6.5
23+ version : 3.7.0
2424 plotly :
2525 description : How to style markers in Python with Plotly.
2626 display_as : file_settings
@@ -305,6 +305,118 @@ fig.show()
305305
306306```
307307
308+ ### Custom Marker Symbols
309+
310+ The ` marker_symbol ` attribute allows you to choose from a wide array of symbols to represent markers in your figures.
311+
312+ The basic symbols are: ` circle ` , ` square ` , ` diamond ` , ` cross ` , ` x ` , ` triangle ` , ` pentagon ` , ` hexagram ` , ` star ` , ` diamond ` , ` hourglass ` , ` bowtie ` , ` asterisk ` , ` hash ` , ` y ` , and ` line ` .
313+
314+ Each basic symbol is also represented by a number. Adding 100 to that number is equivalent to appending the suffix "-open" to a symbol name. Adding 200 is equivalent to appending "-dot" to a symbol name. Adding 300 is equivalent to appending "-open-dot" or "dot-open" to a symbol name.
315+
316+ In the following figures, 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.
317+
318+ #### Basic Symbols
319+
320+ ``` python
321+ import plotly.graph_objects as go
322+ fig = go.Figure()
323+ fig.update_layout(title = " Basic Symbols" )
324+ fig.update_xaxes(showticklabels = False )
325+ fig.update_yaxes(showticklabels = False )
326+
327+ for index in range (27 ):
328+ fig.add_trace(go.Scatter(x = [(index % 6 )], y = [index // 6 ],
329+ marker_symbol = index, marker_color = ' black' ,
330+ marker_size = 10 , showlegend = False ,
331+ text = index, hovertemplate = f ' <b>Symbol Number: { index} </b> ' ))
332+
333+ fig.show()
334+ ```
335+
336+ #### All Symbols
337+
338+ ``` python
339+ import plotly.graph_objects as go
340+ symbols = [0 , ' circle' , 100 , ' circle-open' , 200 , ' circle-dot' , 300 ,
341+ ' circle-open-dot' , 1 , ' square' , 101 , ' square-open' , 201 ,
342+ ' square-dot' , 301 , ' square-open-dot' , 2 , ' diamond' , 102 ,
343+ ' diamond-open' , 202 , ' diamond-dot' , 302 ,
344+ ' diamond-open-dot' , 3 , ' cross' , 103 , ' cross-open' , 203 ,
345+ ' cross-dot' , 303 , ' cross-open-dot' , 4 , ' x' , 104 , ' x-open' ,
346+ 204 , ' x-dot' , 304 , ' x-open-dot' , 5 , ' triangle-up' , 105 ,
347+ ' triangle-up-open' , 205 , ' triangle-up-dot' , 305 ,
348+ ' triangle-up-open-dot' , 6 , ' triangle-down' , 106 ,
349+ ' triangle-down-open' , 206 , ' triangle-down-dot' , 306 ,
350+ ' triangle-down-open-dot' , 7 , ' triangle-left' , 107 ,
351+ ' triangle-left-open' , 207 , ' triangle-left-dot' , 307 ,
352+ ' triangle-left-open-dot' , 8 , ' triangle-right' , 108 ,
353+ ' triangle-right-open' , 208 , ' triangle-right-dot' , 308 ,
354+ ' triangle-right-open-dot' , 9 , ' triangle-ne' , 109 ,
355+ ' triangle-ne-open' , 209 , ' triangle-ne-dot' , 309 ,
356+ ' triangle-ne-open-dot' , 10 , ' triangle-se' , 110 ,
357+ ' triangle-se-open' , 210 , ' triangle-se-dot' , 310 ,
358+ ' triangle-se-open-dot' , 11 , ' triangle-sw' , 111 ,
359+ ' triangle-sw-open' , 211 , ' triangle-sw-dot' , 311 ,
360+ ' triangle-sw-open-dot' , 12 , ' triangle-nw' , 112 ,
361+ ' triangle-nw-open' , 212 , ' triangle-nw-dot' , 312 ,
362+ ' triangle-nw-open-dot' , 13 , ' pentagon' , 113 ,
363+ ' pentagon-open' , 213 , ' pentagon-dot' , 313 ,
364+ ' pentagon-open-dot' , 14 , ' hexagon' , 114 , ' hexagon-open' ,
365+ 214 , ' hexagon-dot' , 314 , ' hexagon-open-dot' , 15 ,
366+ ' hexagon2' , 115 , ' hexagon2-open' , 215 , ' hexagon2-dot' ,
367+ 315 , ' hexagon2-open-dot' , 16 , ' octagon' , 116 ,
368+ ' octagon-open' , 216 , ' octagon-dot' , 316 ,
369+ ' octagon-open-dot' , 17 , ' star' , 117 , ' star-open' , 217 ,
370+ ' star-dot' , 317 , ' star-open-dot' , 18 , ' hexagram' , 118 ,
371+ ' hexagram-open' , 218 , ' hexagram-dot' , 318 ,
372+ ' hexagram-open-dot' , 19 , ' star-triangle-up' , 119 ,
373+ ' star-triangle-up-open' , 219 , ' star-triangle-up-dot' , 319 ,
374+ ' star-triangle-up-open-dot' , 20 , ' star-triangle-down' ,
375+ 120 , ' star-triangle-down-open' , 220 ,
376+ ' star-triangle-down-dot' , 320 ,
377+ ' star-triangle-down-open-dot' , 21 , ' star-square' , 121 ,
378+ ' star-square-open' , 221 , ' star-square-dot' , 321 ,
379+ ' star-square-open-dot' , 22 , ' star-diamond' , 122 ,
380+ ' star-diamond-open' , 222 , ' star-diamond-dot' , 322 ,
381+ ' star-diamond-open-dot' , 23 , ' diamond-tall' , 123 ,
382+ ' diamond-tall-open' , 223 , ' diamond-tall-dot' , 323 ,
383+ ' diamond-tall-open-dot' , 24 , ' diamond-wide' , 124 ,
384+ ' diamond-wide-open' , 224 , ' diamond-wide-dot' , 324 ,
385+ ' diamond-wide-open-dot' , 25 , ' hourglass' , 125 ,
386+ ' hourglass-open' , 26 , ' bowtie' , 126 , ' bowtie-open' , 27 ,
387+ ' circle-cross' , 127 , ' circle-cross-open' , 28 , ' circle-x' ,
388+ 128 , ' circle-x-open' , 29 , ' square-cross' , 129 ,
389+ ' square-cross-open' , 30 , ' square-x' , 130 , ' square-x-open' ,
390+ 31 , ' diamond-cross' , 131 , ' diamond-cross-open' , 32 ,
391+ ' diamond-x' , 132 , ' diamond-x-open' , 33 , ' cross-thin' , 133 ,
392+ ' cross-thin-open' , 34 , ' x-thin' , 134 , ' x-thin-open' , 35 ,
393+ ' asterisk' , 135 , ' asterisk-open' , 36 , ' hash' , 136 ,
394+ ' hash-open' , 236 , ' hash-dot' , 336 , ' hash-open-dot' , 37 ,
395+ ' y-up' , 137 , ' y-up-open' , 38 , ' y-down' , 138 ,
396+ ' y-down-open' , 39 , ' y-left' , 139 , ' y-left-open' , 40 ,
397+ ' y-right' , 140 , ' y-right-open' , 41 , ' line-ew' , 141 ,
398+ ' line-ew-open' , 42 , ' line-ns' , 142 , ' line-ns-open' , 43 ,
399+ ' line-ne' , 143 , ' line-ne-open' , 44 , ' line-nw' , 144 ,
400+ ' line-nw-open' ]
401+
402+ fig = go.Figure()
403+ fig.update_layout(title = " Custom Marker Symbols" )
404+ fig.update_xaxes(showticklabels = False )
405+ fig.update_yaxes(showticklabels = False )
406+
407+ for index, symbol in enumerate (symbols[::2 ]):
408+ fig.add_trace(go.Scatter(x = [(index % 30 )], y = [index // 30 ],
409+ marker_symbol = symbol, marker_color = ' black' ,
410+ marker_size = 10 , showlegend = False ,
411+ hovertext = symbols[2 * index + 1 ], name = ' ' ,
412+ hovertemplate = f ' <b> { symbols[2 * index + 1 ]} </b> '
413+ ))
414+
415+
416+ fig.show()
417+ ```
418+
419+
308420### Reference
309421
310422See https://plot.ly/python/reference/ for more information and chart attribute options!
0 commit comments