ggplot没有输出 [英] No output from ggplot

查看:142
本文介绍了ggplot没有输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

>库(ggplot2)

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

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

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

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?

非常感谢!
Gero

Thanks a lot in advance! Gero

推荐答案

如果您从另一个函数或Shiny中调用该函数,请尝试打印该图:

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)

这篇关于ggplot没有输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆