I have a line plot with a bunch of signals in the form of (wavelength, intensity)
derived from an optics experiment. All of them share the exact same index (wavelength in the range of visible light).
I want to add a simple, static horizontal colorbar legend at the bottom for better visual interpretation.
I've been googling for two whole days and cannot for the life of me get this to work. This should be a very simple and already implemented feature for such a rich plotting library like plotly but I cannot find it anywhere.
I'm using graph_objects.Scatter
, in the following straightforward way:
fig = graph_objects.Figure()
fig.add_trace(
graph_objects.Scatter(
x=signal.wavelength, # signal is a pd.DataFrame
y=signal.intensity,
mode='lines',
line_shape='spline',
text=signal.wavelength,
)
)
I've tried both fig.update_layout()
and fig.update_coloraxes()
with all the combinations I could think of without any luck. Almost all the info I could find either uses px
, wants to assign color to the line itself or uses mode='markers'
instead of lines.
Any hint, reference to other posts, documentation or anything is appreciated.
Relevant links: colorscale, coloraxis, layout