May I ask you for your help, please? I am trying to make a stacked bar chart with plot_ly() from this dataset: link.
However, it does not result in the desired depiction of the bars. First, I tried just a bar plot with the following line (see left hand chart below):
plotly::plot_ly(df, x=~TimePeriod, y=~round(DataValue_per_GDP*100,2),
color=~Sectors, type = "bar") %>%
layout(xaxis = list(title = ""), yaxis = list(title = "(% of GDP)"))
But when I try to make this code as a stacked bar chart the data collapse and does not display the time series with negative values, while displaying the time series with values that have opposite sine, see right hand chart below
plotly::plot_ly(df, x=~TimePeriod, y=~round(DataValue_per_GDP*100,2),
color=~Sectors, type = "bar") %>%
layout(xaxis = list(title = ""), yaxis = list(title = "(% of GDP)"), barmode = 'stack')
What I am doing here in wrong way? I need a stacked bar chart at the end.