Black Lives Matter. Please consider donating to Black Girls Code today.

A legend with parentheses symbols separate from the figure

I have a figure in plotly.py with some geoplots and have some legends. Apart from the ones I have, I want to have an addition in there with marker = ( ) and name=‘some text’. All the marker types I could find was round. So, I couldn’t hack by creating an empty geoplot with these features and activate the showlegend. Any solution?

Hi @tcokyasar indeed there is no parenthesis symbol for markers. You can get a visualization of available symbols by doing for example

import plotly.graph_objects as go
fig = go.Figure()
for i in range(45):
    fig.add_trace(go.Scatter(x=[i], y=[1], 
                             marker_symbol=i, marker_color='black', showlegend=False))
    fig.add_trace(go.Scatter(x=[i], y=[2], 
                             marker_symbol=100 + i, marker_color='black', showlegend=False))
fig.show()

Could you instead use an annotation as a workaround? You could use any text inside an annotation. See for example https://plot.ly/python/text-and-annotations/#styling-and-coloring-annotations