【发布时间】:2019-01-27 07:20:26
【问题描述】:
您好,我在绘制带有 NA 值和 x 轴的图时遇到问题。 我需要点之间的连接,x轴上的数据少就是说每5天看一次,看起来不错。
S_884 = read.csv(file="VA_C_844.csv", header=T)
bar = barplot(S_884$um,plot=F) # para extraer coordenadas
# par(mar=c(7,4,1,4))
###
# IAB
###
par()$mar
png("grafico.png", width = 10, height = 6, units = 'in', res = 250,pointsize=13)
par(mar=c(5,4,4,12))
graf = barplot(S_884$um, axes=T, ylim=c(0,400),
col="grey",xlim = c(0,round(max(bar),0)))
abline(h=0,col="gold")
mtext(2,line=2, cex=0.7,
text=expression(Indice~de~aguas~blancas))
title (main="Eventos marzo - abril 2015", line=1)
axis(side =1, at= bar, labels = substr(S_884$Fecha_C,start=1,stop=131),las=2,cex=0.5,lwd = 1)
box()
###
# Oxigeno
###
range(S_884$Oxigeno)
par(new=T)
plot(bar,S_884$Oxigeno,ylim=range(S_884$Oxigeno[-1], na.rm = TRUE),axes=F,xlab="",ylab="",type="o",col="black",pch=21,bg="blue")
axis(4,at = 0:4,labels = 0:4,lwd=1,line=1,las=2,col="blue")
mtext(4,text=expression(S_884$Oxigeno~paste("(",ml,.L^-1,")")),line=3, cex=0.7)
###
# Temperatura
###
range(S_884$Temp)
par(new=T)
plot(bar, S_884$Temp,ylim=c(15,21),axes=F,xlab="",ylab="",type="o",col="black",pch=21,bg="red")
axis(4,at = 15:21,labels = 15:21,lwd=1,line=4,las=2,col="red")
mtext(4,text="Temperatura (°C)",line=6, cex=0.7)
###
# gradiente
###
range(S_884$Chl_C)
par(new=T)
plot(bar, S_884$Chl_C,ylim=c(0,20),axes=F,xlab="",ylab="",type="o",col="black",pch=21,bg="green")
axis(4,at = seq(0,20,by=2),labels = seq(0,20,by=2),lwd=1,line=8,las=2,col="green")
mtext(4,text="Clorofila (mg3/L)",line=10, cex=0.7)
# artificio para legenda
legend(x="topright",
legend = c("IAB", "Oxígeno","Temperatura","Gradiente"),
lty=c(1,NA,NA,NA),lwd=c(4,1,1,1),
pch=c(NA,21,21,21),
col=c("gray","black","black","black"),
pt.bg=c("gray","blue","red","green"),bty = "n")
dev.off()
我得到这个
这是我的数据
帮帮我!
【问题讨论】:
标签: r date plot time-series na