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.
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.
There are two things to get this to work. First, glyph “14” is not a valid glyph so it thinks it needs to map that to the theme. See point_types() to see possible values for glyph. Second, specifying the “data” argument makes rbokeh try to look for other things in the supplied data frame. We are actively working on making this more robust. But for now, here’s what you want to do to get things to work:
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.
oh. Didn’t think to skip the data argument. Thanks Ryan.
···
On Friday, October 9, 2015 at 8:31:18 AM UTC-7, Ryan Hafen wrote:
There are two things to get this to work. First, glyph “14” is not a valid glyph so it thinks it needs to map that to the theme. See point_types() to see possible values for glyph. Second, specifying the “data” argument makes rbokeh try to look for other things in the supplied data frame. We are actively working on making this more robust. But for now, here’s what you want to do to get things to work:
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.