相关疑难解决方法(0)

使用ggplot2放置多时乐面板的标题

从这里找到的帮助我设法创建了这个多时隙面板: 在此输入图像描述 使用以下代码:

library(zoo)
library(ggplot2)

datos=read.csv("paterna.dat",sep=";",header=T,na.strings="-99.9")

datos$dia=as.POSIXct(datos[,1], format="%y/%m/%d %H:%M:%S")

datos$Precipitación[is.na(datos$Precipitación)]=0
xlim = as.POSIXct(c("2010-05-12 00:00:00", "2010-05-12 23:50:00"))
ylim = trunc(max(datos$Precipitación) + 5)
tmax = trunc(max(datos$Temperatura) + 5)
tmin = trunc(min(datos$Temperatura) - 5)

tmx = max(datos$Temperatura) 
tmxpos=which.max(datos$Temperatura) 
tmn = min(datos$Temperatura) 
tmnpos=which.min(datos$Temperatura) 

tmp=ggplot(data=datos,aes(x=dia, y=Temperatura)) + geom_line(colour="red") + ylab("Temperatura (ºC)") + 
xlab(" ") + scale_x_datetime(limits=xlim ,format = "%H",major='hour') + scale_y_continuous(limits = c(tmin,tmax)) + geom_text(data=datos[tmxpos,], label=tmx, vjust=-1.5, colour="red") + geom_text(data=datos[tmnpos,], label=tmn, vjust=1.5, colour="blue")

pre=ggplot(data=datos,aes(x=dia, y=Precipitación)) + geom_bar(colour="blue",stat="identity",fill="blue") +
ylab("Precipitación (l)") + xlab("Hora solar") + scale_x_datetime(limits=xlim ,format …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

28
推荐指数
2
解决办法
3万
查看次数

How to add a title for a grid.layout figure in ggplot2?

I am using grid.layout() function to arrange a number of plots in one single figure. However, I do not know how to add a main title for the whole figure (at the mid-top of the figure)?

有人知道这一点并且可以帮助我吗?非常感谢!

r ggplot2

2
推荐指数
1
解决办法
2414
查看次数

标签 统计

ggplot2 ×2

r ×2