The output is not displayed properly in SpectrumPlot.
When viewing MS data, the output is not displayed properly, as shown below. I'd like to solve this problem - could you point out which part I should check?
Thanks for reporting. The plotly spectrum example in the docs seems to be working fine as expected.
Can you provide a bit more information (reprex) to how you produced the plot so we can figure out what the issue is? The tooltips are set in the _add_tooltips method of the backend specific plotting engine. That would be a good place to start.
I produced the plot using the Streamlit template.
Okay, thanks. I'll check the _add_tooltips method more thoroughly.
@singjc
Hi, Thanks for feedback.
I checked docs link you sent. However, That links to Bokeh Plot, Not Plotly plot.
Could you check this link?
https://pyopenms-viz.readthedocs.io/en/latest/gallery/ms_plotly/plot_spectrum_ms_plotly.html
The actual value isn't 102, but the tooltip shows 102.
Hi, Thanks for feedback.
I checked docs link you sent. However, That links to Bokeh Plot, Not Plotly plot.
Could you check this link?
https://pyopenms-viz.readthedocs.io/en/latest/gallery/ms_plotly/plot_spectrum_ms_plotly.html
The actual value isn't 102, but the tooltip shows 102.
Ahh, I see. There seems to be the same issue for the chromatogram plot, the peakmap plot seems fine though. There must be something wrong with the tooltip data setup, probably incorrect key : value matching in pyopenms_viz/_plotly/core.py#L547.
@singjc
I resolved the issue by modifying the part in the _add_tooltips method that updates customdata in fig.data, and now the data is displayed correctly as shown in the attached image. However, I'm not sure what needs to be modified for the chromatogram and the streamlit-template.
In Streamlit, when a graph is displayed and the length of fig.data is 1, the _add_tooltips method calls fig.update_traces and directly assigns custom_hover_data to customdata. I think this part is causing the issue. I don't understand why the update_traces method is called when the length of fig.data is not greater than 1. Can you explain what the update_traces method does?