I have a palette I need to use in sequence, i.e. when one category exists -> use first color, two categories use first color and second and so on.
How do I make sure this happens? Right now plotly is choosing element 5 of my color vector when I only have one category, for example.
chart_colors <- c("#FF4338", "#757C89", "#BCBF5E", "#C98989", "#F2BEBE",
"#D0D0E7", "#233EBE", "#f2bd94", "#4B4737", "#703D3A")
plot_ly(data = plotData, x = ~balance_date, y = ~balance,
color = ~account, colors = chart_colors,
mode = "lines", showlegend = FALSE)