Some marker types don't display in Plotly-Dash scatter plot

Viewed 985

I'm trying to use a custom marker type in a plotly dash app. I'm defining my graph as below:

html.Div(
    [
        dcc.Graph(
            figure=dict(
                data=[
                    dict(
                        x=[5, 10, 20, 15],
                        y=[1, 2, 1, 3],
                        type='scatter',
                        mode='markers',
                        marker=dict(
                            color='Red',
                            symbol='line-ns',
                            size=20,
                            opacity=1,
                        ),
                    ),
                ],
                layout=dict(),
            ),
            id='my-graph',
        ),
    ],
),

When I use symbol='square' it works as shown on the left below, but when symbol='line-ns' the hover works, but the symbol is invisible.

enter image description here enter image description here

The basic symbols seem to work, but most of the less common symbols seem to have this problem.

Looking at the documentation here:

https://plotly.com/python/marker-style/#custom-marker-symbols

I have an example in a notebook where symbol='line-ns' does work using the graph objects:

import plotly.graph_objects as go

# Generate example data
import numpy as np

# Build figure
fig = go.Figure()

# Add trace with large markers
fig.add_trace(
    go.Scatter(
        mode='markers',
        x=[2, 2],
        y=[4.25, 4.75],
        marker=dict(
            symbol='line-ns',
            color='rgba(135, 206, 250, 0.5)',
            size=40,
            line=dict(
                color='MediumPurple',
                width=8
            )
        ),
        showlegend=False
    )
)

fig.show()
2 Answers

I have the same problem and haven't found any solution yet. However symbol='line-ns-open' works for me with a somehow similar result.

I found the same issue. It seems the shapes that have no filling are not displayed: shapes 33 to 45 (cross_thin to line_nw). The other ones can be displayed normally.

I could solve it by specifying the line_width parameter for the markers.

marker=dict(symbol='line-ns',
            line_width=2)
Related