Reputation: 529
I have a plotly scatter plot consisting of 9 trace scatter plots on one that is going into a Dash Dashboard.
I have only provided the first trace to make the code shorter and easier but If you need to see the other 8 I can provide them (they are all similar to this trace).
I need help to do the following:
Change the font-size of the hover text
Give a cut-off length to the hover text as at the moment it continues off the page.
trace0= go.Scatter(
x =df[df['Topic'] == 'Time consuming tasks']['x'],
y = df[df['Topic'] == 'Time consuming tasks']['y'],
mode = 'markers',
text= df[df['Topic'] == 'Time consuming tasks']['challenges'],
marker = dict(
size = 9,
line = dict(
width = 2,
)
),
name = 'First Plot',
showlegend=True)
app.layout = html.Div([dcc.Graph(id='scatterplot',
figure = {'data' : [trace0, trace1, trace2, trace3, trace4, trace5, trace6, trace7, trace8],
'layout' : go.Layout(title='Biggest hindrances in your life?',
xaxis = {'title':'x axis'},
yaxis = {'title': 'y axis'},
height = 550,
titlefont= {'size':33},
hovermode = 'closest',
legend=dict(
traceorder='normal',
font=dict(
family='sans-serif',
size=25,
color='#000'
)
)
)
}
)
])
Thanks guys!
Upvotes: 0
Views: 6068
Reputation: 919
I did not run your full example, however, in my case, the following solved the issue:
go.Layout(title='Biggest hindrances in your life?',
#other options for the plot
hoverlabel=dict(font=dict(family='sans-serif', size=25)))
Hope that answeres point 1.
Edit
Just found this page, might also be useful https://plotly.com/python/hover-text-and-formatting/
Upvotes: 2