Histogram from a Dataframe with selected lengh for each bin gave by DF

Dear Plotlier,

I have a question, I use a lot plotly for my work.

I have a dataframe with logs. Each line have the name of the logs, the start, the end, others info like lost of prod or else. I would like to create bar/histogram plot with:

  • Yaxis the lostprod
  • Xaxis datetime, on it each type of log. For each type of log I would like the bar to begin at the StartLog and to finish at the EndLog

I already do something like that but with many log the bar are so thin that plotly doesn’t display anything…

My code :

  for element in input_Logs_Reto:
            df_log_unique_WEA = df_temp.loc[df_temp['error text'] == element]
            df_log_unique_WEA= df_log_unique_WEA.sort_values(by=['StartError3'])
            fig.add_trace(
                go.Bar(x=df_log_unique_WEA['StartError3'],y=df_log_unique_WEA['duration seconds'], name=element,
                       customdata = df_log_unique_WEA['lostProd'],
                       text=df_log_unique_WEA['WEA'].squeeze(),
                       hovertemplate="<br>".join([
                           "logs: %{x}",
                           "Losses: %{customdata} kWh"])
                             ))
            fig.update_layout(yaxis=dict(title= 'logs [s]')

Thanks guys !

Thomas