How to add the horizontal white spikeline from hovermode='y unified'
to the y axis tag from hovermode='y'
(and remove the hovertemplate (inside the plot area) ? The result should have the gray label and a white solid line across the chart where the mouse (or otherwise a datapoint nearby is).
with hovermode='y'
it is:
import numpy as np
import plotly.graph_objects as pl_go
import plotly.express as px
slug = np.random.random_sample((200,))
fig = pl_go.Figure()
fig.add_trace( # DYNAMIC
pl_go.Scatter(x=slug[:100],
y=slug[100:],
name='trace1_y1',
# marker_line_width=0,
# marker_color='green' # or array,
# hovertemplate=None,
)
)
# fig.update_traces(hovertemplate=None)
fig.update_layout(
xaxis_zeroline=False,
# yaxis_zeroline=False,
yaxis=dict(
tickfont=dict(size=14, color='#e6e6e6'),
# title='Quote',
# titlefont_size=16,
gridcolor='#283442',
linecolor='#283442',
spikecolor="white", spikethickness=1, spikedash='solid', spikemode='across',
),
# hoverdistance=0,
hovermode='y',
font=dict(
color='white',
size=15
),
paper_bgcolor='rgb(17,17,17)',
plot_bgcolor='rgb(17,17,17)',
)
fig.show()
related: forum found without solution: Spikes or crosshair on 2D plots
https://stackoverflow.com/questions/61794582/plotly-how-to-only-show-vertical-and-horizontal-line-crosshair-as-hoverinfo
EDIT: is there a simple solution to get a crosshair under the cursor with x,y coordinates displayed near the tickerlabels, no local hover box? so much doc* but no simple crosshair