您能否指导我如何在ts.plot中添加符号。我尝试了很多次,但是失败了。 预先感谢 mydata
Observed Access.RCP4.5 CNMR.RCP4.5 MPI.RCP4.5 NorESM.RCP4.5 REMO2009.RCP4.5
Jan 4.3764 3.856444 18.26467 2.480333 2.85800 5.479667
Feb 6.7616 11.034222 15.42100 8.405333 13.58133 18.253333
Mar 25.2640 16.128333 37.34267 26.992667 42.45233 30.049000
Apr 86.9132 84.745111 111.23333 160.036333 107.68167 67.897000
May 235.5748 223.157333 201.09367 246.836667 175.63500 287.011667
Jun 249.3072 247.206556 216.39933 239.379000 236.35267 309.790000
Jul 244.5832 229.426778 208.82900 167.600333 219.37767 268.169333
Aug 317.7508 267.743444 308.09967 243.981333 234.11000 312.521000
Sep 309.7856 284.842444 261.71667 279.840667 297.04600 233.897333
Oct 250.6404 168.705000 241.27633 265.809667 254.51600 225.040333
Nov 95.6340 130.540444 69.05800 82.628667 65.94667 65.741000
Dec 26.2928 26.382222 27.12500 36.647667 13.68367 31.547667
我的代码
library(xts)
require(tidyr)
library(tidyverse)
library(lattice)
Mydata <- read.csv(file="BMT pr near 4.5.csv", header=TRUE, sep=",", row.names = 1) #********change name
ts.plot(Mydata,gpars= list(xlab="Month", ylab="Average rainfall (mm)",xaxt='n',
main = "Monthly rainfall at Buon Ma Thuot Station of 2020s (RCP4.5)" ,cex.main=1,
pch = c(NA, 20, 18, 3, 2, 8),
lty = c("dashed","solid", "solid", "solid", "solid", "solid"),lwd=1.5, col=c("black", "blue", "green", "orange","red", "purple")
))
axis(1, at=1:12, labels = format(ISOdate(2000, 1:12, 1), "%b"))
legend(1, 320, legend=c("Observed","Access", "CNMR", "MPI", "NorESM", "REMO2009"),
col=c("black", "blue", "green", "orange","red", "purple"), lty = c("dashed","solid", "solid", "solid", "solid", "solid"), pch = c(NA, 20, 18, 3, 2, 8), cex=0.6)
我需要在图中添加与图例相同的符号
数据类型
data.frame(
Observed = c(4.3764, 6.7616, 25.264, 86.9132, 235.5748, 249.3072),
Access.RCP4.5 = c(3.856444444, 11.03422222, 16.12833333, 84.74511111,
223.1573333, 247.2065556),
CNMR.RCP4.5 = c(18.26466667, 15.421, 37.34266667, 111.2333333,
201.0936667, 216.3993333),
MPI.RCP4.5 = c(2.480333333, 8.405333333, 26.99266667, 160.0363333,
246.8366667, 239.379),
NorESM.RCP4.5 = c(2.858, 13.58133333, 42.45233333, 107.6816667, 175.635,
236.3526667),
REMO2009.RCP4.5 = c(5.479666667, 18.25333333, 30.049, 67.897, 287.0116667,
309.79)
)