I need to plot a pivot chart from a multi-indexed pivot table. This is my pivot table description " multi_index = pd.pivot_table(df_new, index = [‘Device_ID’, ‘Temp’ ,‘Supply’],columns = ‘Frequency’, values = ‘NoiseLevel’,)"
I used Plotly at that time it is coming as a single straight line. I am expecting two zig-zag lines one for frequency 0.8 and the other for 1.6 as shown in the first figure. could you please tell me where I went wrong? please see my code below. I don’t know where I need to put the “columns = ‘Frequency’” I think it needs to come at Y axis. Please see my dta frame below(Pivot Table)
Frequency 0.8 1.6
Device_ID Temp Supply
FF_2649 -40.0 1.65 -100.72 -101.35
1.71 -100.61 -101.74
1.80 -100.74 -101.64
1.89 -100.63 -101.69
3.60 -100.60 -101.46
... ... ...
TT_2441 85.0 1.65 -94.99 -94.97
1.71 -94.85 -95.24
1.80 -95.02 -94.97
1.89 -94.69 -96.20
3.60 -94.90 -94.91
My code is given below.
data=[go.Scatter(
x=multi_index.index,
y=multi_index.values,
mode='lines',
name='Noise Level'
)]
layout=go.Layout(title='Noise Level')
figure=go.Figure(data=data,layout=layout)
pyo.plot(figure)
I am expecting two line charts one for Frequency 0.8 and other for frequency 1.6 .