我想绘制一些在9月和10月收获前确定的苹果成熟度参数-并在同一图上绘制三个苹果在3月出库时测得的质量参数。我正在使用gap.plot函数(plotrix程序包)删除x轴上没有数据(11月至1月)的时间段。我无法让x轴显示更多日期,并且第一个y轴(应显示从0到14的清晰比例)没有正确显示
here is the plot with incorrect x & first y-axis labelling
脚本绘制白利糖度坚硬淀粉和收获前和保质期的收获指数
将数据绘制为文本表
date brix firmness starch harvest_index
18.09.2017 9.2 9.8 2.2 0.5
20.09.2017 10.6 10.0 1.5 0.6
27.09.2017 10.0 9.7 4.5 0.2
04.10.2017 10.6 9.7 3.4 0.3
11.10.2017 10.7 9.5 4.3 0.2
17.10.2017 11.1 9.6 4.8 0.2
18.10.2017 11.2 8.9 5.6 0.1
08.03.2018 12.8 8.3 NA NA
13.03.2018 12.5 7.8 NA NA
library(plotrix)
pd <- read.csv2("maturity data.csv", header=T)
# to change date column to date format
pd$date <- as.Date(pd$date,"%d.%m.%Y")
par(mar=c(5,10,4,5)+.1)
heading = paste("2017/18 Maturity & Quality Parameters\n Pre-harvest & during shelf-life")
gap.plot( pd$date, pd$firmness,gap=c(as.Date("2017-10-20"), as.Date("2018-03-05")), gap.axis="pd$date",
type="b", col="green", xlab="Date", ylab="Brix, Firnmness & Starch", lwd=2, bty="n", ylim= c(0,14) )
par(new=TRUE)
gap.plot( pd$date, pd$brix,gap=c(as.Date("2017-10-20"), as.Date("2018-03-05")), gap.axis="pd$date",
type="b", col="blue",xlab="",ylab="", lwd=1, ylim = c(0,14))
axis(2, lwd=2)
par(new=TRUE)
gap.plot( pd$date, pd$starch, gap=c(as.Date("2017-10-20"), as.Date("2018-03-05")), gap.axis="pd$date",
type="b", col="black",xlab="",ylab="", lwd=1, ylim = c(0,14))
axis(2, lwd=2)
par(new=TRUE)
gap.plot( pd$date, pd$harvest_index,gap=c(as.Date("2017-10-20"), as.Date("2018-03-05")), gap.axis="pd$date",
type="b", col="red",xlab="",ylab="", lwd=1, ylim = c(0,1))
axis(2, line=4.5, lwd=2)
mtext("Harvest Index", side=2,line=7)
title (main = heading, col.main="black")
legend("topleft",col=c("green","blue", "black", "red"),lty=1,legend=c("Firmness", "Brix", "Starch","Harvest Index"), cex=0.75, lwd=1)