I'm really new to using plotly and after reading the documentation, I can't seem to figure out why this code won't change the colours of the individual bars.
My data set is mtcars reduced to only the MPG and CYL columns.
This is the code that I'm using:
mtcars %>%
plot_ly(x = ~cyl,
y = ~mpg,
type = "bar",
marker = list(color = c('rgba(204,204,204,1)', 'rgba(222,45,38,0.8)',
'rgba(204,204,204,1)') )
) %>%
layout(title = "Test Chart",
xaxis = list(title = "Cylinders"),
yaxis = list(title = "MPG")
)
For some reason it only displays all 3 bars (4/6/8 cyl) as black. What am I doing wrong?
Thanks.
_reduced
behind themtcars
code works also with full dataframe – mischva11