【发布时间】:2020-10-07 21:28:56
【问题描述】:
我是 R 新手,对 ggplot2 有一些问题。 我尝试使用此代码在 ggplot 上绘制 geom_line:
gplot(shm_data ,aes(X, Y, fill= Count)) +
geom_tile(aes(X,Y,alpha=Count))+
scale_fill_gradientn(colours=c("yellow","orange","red"),na.value = NA,guide=FALSE)+
scale_y_continuous(trans = "reverse")+
scale_alpha(guide=FALSE,range = c(0.25,1))+
ggtitle(paste0("heat map of ",
substring(session_name,1, regexpr("-", session_name) - 1)))+
geom_line(data=smooth_cm,aes(x,y),inherit.aes=FALSE,na.rm=TRUE)
代码在我的 ggplot 上生成了这个图:
我希望它成为我的 ggplot 的常规情节, 看起来像这样:
上图的代码是:
plot(y~x , ylim = rev(range(y,na.rm=TRUE)),type='l')
我无法理解这个问题,并提前感谢您抽出时间回答我的问题。
【问题讨论】: