No output from ggplot

Deadly 提交于 2019-12-11 15:10:26

问题


Sorry to bother you with what is for sure a very simple mistake, but I still cannot figure it out by myself:

library(ggplot2)

X = rep(c(1:6),3)
Y = rep(c(1:6),3)
group = rep(c(1:3), each = 6)

data = data.frame(X = X, Y = Y, group = group)

ggplot(data, aes(x = X, y = Y, group = group)) + geom_point() 

I do not get any output from this, no figure is created. What am I doing wrong here?

Thanks a lot in advance! Gero


回答1:


Try print the plot if you are calling it from another function or in Shiny:

myplot <- ggplot(data, aes(x = X, y = Y, group = group)) + geom_point() 

print(myplot)


来源:https://stackoverflow.com/questions/46034581/no-output-from-ggplot

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