ggVis : creating a plot with multiple layers on different dataset

帅比萌擦擦* 提交于 2019-12-04 03:10:47

The problem is that when you try to combine the two, you do not group_by Cluster on the ellipsis dataset. You need to do the following for it to work:

myFullPlot <- ggvis(data = df_ellipse, x = ~x, y = ~ y) %>% group_by(Cluster) %>%

  layer_paths(stroke = ~Cluster, strokeWidth := 1) %>%

  layer_points(x = ~Axis1, y= ~Axis2, size := 15, fill= ~Cluster, data = ggDF)

myFullPlot

And this way you get the graph you want!

P.S. I assume there is some randomness in your data creation because I got a different data set than yours.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!