Hi! I am trying to plot a cumulative histogram in Plotly. This is the code I used for my plot:
fig = go.Figure(data=[go.Histogram(y=df_turbine_name[‘0’],cumulative_enabled=True)])
fig.show()
The data used is a column from a dataframe.
This is the graph I get:
However, I would like to reverse the shape of the histogram. I plotted what I would like to get in Matplotlib:
(Ignore the red line)
This is the Matplotlib code:
x = df_turbine_name[‘0’]
plt.figure(figsize=(20,10))
ax = plt.hist(x,100,orientation = ‘horizontal’ ,cumulative=-1,edgecolor=‘black’)
plt.xlabel(‘Frequency [%]’)
plt.ylabel(‘Power [kW]’)
plt.gca().xaxis.set_major_formatter(mtick.PercentFormatter(52560))
plt.axhline(y=5000, color=‘r’, linestyle=’-’)
plt.show()
Basically, Plotly is doing the cumulative sum the other way round and I was wondering if there is a Plotly equivalent to the ‘cumulative = -1’ from Matplotlib. In case you were wondering if you set ‘cumulative = True’ in Matplotlib you get the same shape of graph I got in Plotly. The -1 value makes the opposite sum of cumulative values.
Any chance someone knows how can I get the histogram I plotted in Matplotlib in Plotly?
Thanks in advance.Preformatted text