I have a dataframe 'df' with 36 columns, these columns are plotted onto a single plotly chart and displayed in html format using the code below.
import plotly.offline as py
import plotly.io as pio
pio.write_html(py.offline.plot([{
'x': df.index,
'y': df[col],
'name': col
}for col in trend_data.columns], filename=new_file_path))
I want to iterate through each column and create a subplot for each one. I have tried;
from plotly.subplots import make_subplots
sub_titles = df.columns()
fig = make_subplots(rows=6, cols=6, start_cell="bottom-left", subplot_titles=sub_titles)
for i in df.columns:
fig.add_trace(i)
I created 6 rows and columns as that would give 36 plots and tried to use the header names as subplot titles but I get a ValueError stating it was expecting a 2d list of dictionaries.
Also, I have tried to add subplot titles by;
sub_titles = list(df)
fig = py.subplots.make_subplots(rows=6, cols=6, sub_titles=sub_titles)
This also returns an error. Any help is appreciatted.