I am trying to make a couple of plots (code below) and to keep the colors consistent between the two graphs. One graph contains 8 data points and the other contains 5. Despite using almost identical code for each of the plots, the colors do not match up. Does anyone have any insight as to why the colors are not matching up between the two graphs?
Correct colors (https://plot.ly/~MKT533/3/#/):
p <- plot_ly(mkt533, x = ~onsitetrainers_x, y = ~lowprice_y, z = ~flexibleclasses_z, color = ~name, colors = c(’#AB1100’,’#00274C’,’#00B5AF’,’#00274C’,’#00274C’,’#72088E’,’#E9B000’,’#0050AC’)) %>%
add_markers() %>%
layout(scene = list(xaxis = list(title = ‘Professional guidance’, range=c(1,10)),
yaxis = list(title = ‘Value for money’, range=c(1,10)),
zaxis = list(title = ‘Time flexibility’, range=c(1,10))))
Wrong colors (https://plot.ly/~MKT533/1/#/):
mkt533_product <- subset(mkt533, type!=“Segment”)
product <- plot_ly(mkt533_product, x = ~onsitetrainers_x, y = ~lowprice_y, z = ~flexibleclasses_z, color = ~name, colors = c(’#AB1100’,’#00B5AF’,’#72088E’,’#E9B000’,’#0050AC’)) %>%
add_markers() %>%
layout(scene = list(xaxis = list(title = ‘Professional guidance’, range=c(1,10)),
yaxis = list(title = ‘Value for money’, range=c(1,10)),
zaxis = list(title = ‘Time flexibility’, range=c(1,10))))