@@ -319,16 +319,20 @@ In the following figures, hover over a symbol to see its name or number. Set the
319
319
320
320
``` python
321
321
import plotly.graph_objects as go
322
+
322
323
fig = go.Figure()
324
+
323
325
fig.update_layout(title = " Basic Symbols" )
326
+
324
327
fig.update_xaxes(showticklabels = False )
325
328
fig.update_yaxes(showticklabels = False )
326
329
327
330
for index in range (27 ):
328
331
fig.add_trace(go.Scatter(x = [(index % 6 )], y = [index // 6 ], name = " " ,
329
332
marker_symbol = index, marker_color = ' black' ,
330
- marker_size = 10 , showlegend = False ,
331
- text = index, hovertemplate = f ' <b>Symbol Number: { index} </b> ' ))
333
+ marker_size = 10 , showlegend = False , mode = " markers+text" ,
334
+ textposition = " middle right" , text = f ' <b> { index} </b> ' ,
335
+ hovertemplate = f ' <b>Symbol Number: { index} </b> ' ))
332
336
333
337
fig.show()
334
338
```
@@ -337,6 +341,7 @@ fig.show()
337
341
338
342
``` python
339
343
import plotly.graph_objects as go
344
+
340
345
symbols = [0 , ' circle' , 100 , ' circle-open' , 200 , ' circle-dot' , 300 ,
341
346
' circle-open-dot' , 1 , ' square' , 101 , ' square-open' , 201 ,
342
347
' square-dot' , 301 , ' square-open-dot' , 2 , ' diamond' , 102 ,
@@ -400,19 +405,21 @@ symbols = [0, 'circle', 100, 'circle-open', 200, 'circle-dot', 300,
400
405
' line-nw-open' ]
401
406
402
407
fig = go.Figure()
403
- fig.update_layout(title = " Custom Marker Symbols" )
408
+
409
+ fig.update_layout(title = " Custom Marker Symbols" , height = 800 )
410
+
404
411
fig.update_xaxes(showticklabels = False )
405
412
fig.update_yaxes(showticklabels = False )
406
413
407
414
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> '
415
+ fig.add_trace(go.Scatter(x = [(index % 16 )], y = [(index // 16 )],
416
+ marker_symbol = symbol, marker_color = index,
417
+ marker_size = 20 , showlegend = False , mode = " markers+text" ,
418
+ name = ' ' ,
419
+ hovertemplate = f ' <b>Symbol Name: { symbols[2 * index + 1 ]} </b><br><b>Symbol Number: { symbols[2 * index]} </b> ' ,
420
+ textfont_size = 8
413
421
))
414
-
415
-
422
+
416
423
fig.show()
417
424
```
418
425
0 commit comments