I am having a problem with the hoverlabel in the plotly/dash app that I am developing. For some reason I am experiencing two issues when using hovermode='y unified'
1: For some reason it is not always displaying the values at the same depth, see Fig1 below. For the blue curve it picks y=1,979.2, for the red curve it picks 1,979.3, for the two black curves it picks 1,979.0. The curves I am plotting all share the same pandas dataframe index, so they all have values at the same y points.
2: Zooming in, I show that all the curves are indeed continuous around y=1979. But Fig2 shows the second problem. Sometimes it does not display the values of all curves. In this case the blue one is not displayed (perhaps because it is the furthest away from the cursor, which should not matter for 'y unified'?)
Am I perhaps misunderstanding the desired behavior of hovermode 'y unified'? Any help would be appreciated. Thanks!
def create_fig(curve_df, stored_yaxis_range_min, stored_yaxis_range_max, zeroline_x=False):
#Plot all the curves in the dataframe using the column title
#Make sure the column title is what you want the label to be (otherwise rename column)
curve_names = curve_df.columns
color_list, curve_names_out = make_color_list(curve_names)
#rename columns with new names
for inname, outname in zip(curve_names, curve_names_out):
curve_df = curve_df.rename(columns={inname: outname})
fig = px.line(curve_df, x=curve_df.columns, y=curve_df.index, labels={'x':curve_names, 'y':curve_df.index.name}, color_discrete_sequence=color_list)
fig.update_xaxes(fixedrange=True)
if not stored_yaxis_range_min or not stored_yaxis_range_max: #If not set (could be a None, or could be False which is the value i give when loading a new .las)
fig.update_yaxes(autorange="reversed") #I don't think we can end up here anymore now that loading an .las would update max and min depth, which then triggers update_yaxis_range_store
else: #min and max zoom level are already determined. Set them for the figure (this can trigger if toggling another property)
fig['layout']['yaxis']['autorange'] = False
fig['layout']['yaxis']['range'] = [stored_yaxis_range_max,stored_yaxis_range_min]
fig.update_xaxes(zeroline=zeroline_x, zerolinecolor = 'black')
#set other layout
fig.update_layout(
showlegend=False,
plot_bgcolor="white",
margin=dict(t=0,l=0,b=0,r=0),
font_color = 'black',
font_size = 10,
hovermode='y unified',
hoverlabel=dict(font_size=10),
xaxis_title="Value",
)
fig_style = {'display': 'block', "height": 700, "width": "100%"} #The display is needed to get figure to appear?
return fig, fig_style

