Reputation: 32111
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.
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()
Upvotes: 6
Views: 2187
Reputation: 161
The same is for color
, which implies that line = dict(color, width)
does not work inside marker = dict()
and it is necessary to use line_color
and line_width
instead ... maybe other line
attributes are being affected too.
Upvotes: 0
Reputation: 86
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)
Upvotes: 7
Reputation: 133
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.
Upvotes: 5