This is basically what I want to do:
data(iris)
colors = c("red","blue","black")
glyphs = c(13,14,15)
data0 = split(iris, list(Species=iris$Species))
legends = unlist(lapply(data0, function(s) unique(s$Species)))
p = figure()
for(i in seq_along(data0)){
p = p %>% ly_points(Sepal.Length, Sepal.Width, data= data0[[i]],color=colors[i], glyph=glyphs[i], legend=legends[i])
}
p
#try again...
i = 1
p = p %>% ly_points(Sepal.Length, Sepal.Width, data= data0[[i]],color=colors[i], glyph=glyphs[i], legend=legends[i])
p
But it doesn’t work. I don’t want to use the built in glyph and color by factor level because in actual fact I am layering Kaplan Meier survival plots and I need fine control over the color and glyphs, and I am happy to use ly_points in a loop to manage that, but I can’t figure out the correct call to do so.

