1
私の基本的なデータ:可視化のRを使用すると、私の凡例に「赤い矢印」の概念を追加する方法は?
x<-seq(0.1,10,0.1);
pc<-c(3.15442318918057e-12, 0.279696583447893, 46.6181435901529,
250.836973686643, 523.421780720784, 739.300706422385, 866.627345572145,
921.211008429192, 927.180974116758, 904.039048436514, 860.268939825653,
813.779427218786, 767.324250685093, 722.421081777766, 679.851548532288,
639.962815022719, 602.849093671684, 568.460926140937, 536.670948066141,
507.313326251938, 480.207192971438, 455.170317699782, 432.026814710122,
410.611214293774, 390.770332272407, 372.363825591023, 355.2639842963,
339.355100526104, 324.532624154458, 310.70223261091, 298.023917798257,
286.158000767187, 275.03700789928, 264.59926448491, 254.78923100742,
245.556817376394, 236.85677750977, 228.648175531947, 220.893915372497,
213.560326236011, 206.616797159371, 200.035454614992, 193.790877822341,
187.859847077672, 182.221120996426, 176.855239083359, 171.744346504937,
166.872038341436, 162.223220947933, 157.783988359483, 153.541511941623,
149.483941717966, 145.600318006503, 141.880492169501, 138.315055431982,
134.895274853964, 131.613035654632, 128.460789184621, 125.431505927934,
122.518632989108, 119.716055585925, 117.018062124278, 114.419312481016,
111.914809163644, 109.499871053384, 107.170109471156, 104.921406335022,
102.749894203115, 100.651938018511, 98.6241183922642, 96.663216278306,
94.7661989092833, 92.9302068761092, 91.152542246058, 89.430657624987,
87.7621460787913, 86.1447318376806, 84.5762617144209, 83.0546971744162,
81.578107001521, 80.1446605088463, 78.7526212486342, 77.400341179586,
76.0862552538919, 74.8088763896853, 73.5667907977617, 72.3586536342153,
71.1831849531707, 70.0391659360753, 68.9254353760731, 67.8408863978452,
66.7844633949851, 65.7551591685024, 64.75201225143, 63.7741044057648,
62.8205582791102, 61.8905352094213, 60.983233167201, 60.0978848253439,
59.2337557476149)
pc2<-c(3.81685205890849e-12, 0.338432865971951, 56.4079537440851,
303.512738160838, 633.340354672149, 894.553854771086, 1048.6190881423,
1114.66532019932, 1121.88897868128, 1093.88724860818, 1040.92541718904,
984.673106934731, 928.462343328963, 874.129508951097, 822.620373724069,
774.35500617749, 729.447403342738, 687.837720630534, 649.371847160031,
613.849124764845, 581.05070349544, 550.756084416737, 522.752445799248,
496.839569295467, 472.2049613, 450.560228965138, 429.869420998523,
410.619671636586, 392.684475226894, 375.949701459201, 360.608940535891,
346.251180928296, 332.794779558128, 320.165110026742, 308.294969518979,
297.123749025437, 286.596700786821, 276.664292393656, 267.281637600721,
258.407994745574, 250.006324562839, 242.04290008414, 234.486962165033,
227.310414963983, 220.487556405675, 213.994839290864, 207.810659270974,
201.915166393137, 196.290097346999, 190.918625914974, 185.785229449364,
180.875569478739, 176.176384787868, 171.675395525097, 167.361217072698,
163.223282573297, 159.251773142104, 155.437554913392, 151.7721221728,
148.247545916821, 144.85642725897, 141.591855170376, 138.447368102029,
135.41691908801, 132.494843974595, 129.675832460099, 126.954901665377,
124.32737198577, 121.788845002398, 119.33518325464, 116.96249169675,
114.667100680233, 112.445550320092, 110.29457611773, 108.211095726234,
106.192196755338, 104.235125523594, 102.337276674449, 100.496183581044,
98.7095094718405, 96.9750392157041, 95.2906717108474, 93.654412827299,
92.0643688572092, 90.5187404315192, 89.0158168652917, 87.5539708974006,
86.1316537933366, 84.7473907826511, 83.3997768050484, 82.0874725413927,
80.809200707932, 79.5637425938879, 78.3499348242303, 77.1666663309755,
76.0128755177233, 74.8875476033998, 73.7897121323132, 72.7184406386662,
71.6728444546141);
マイプロセス:
par(lty=2,lwd=2,mar=c(5,5,3,2))
plot(x,pc2,type="l",xlab = "观测点距污染点源的距离(千米)",ylab = "污染物浓度(微克/立方米)",cex.axis=1.5,cex.lab=1.5
,col="black");axis(side=1,at=c(1,2,3,4,5,6,7,8,9),cex.axis=1.5,cex.lab=1.5)
par(lty=1,lwd=2)
lines(x,pc,col="black")
legend(7.6, 1200,c("基准值+10%","基准值"), lty = c(2,1),lwd=c(2,2), col =c("black","black"),cex=1.2,bty="n",x.intersp = 0.2,y.intersp = 0.5)
#4KM
par(lty=1,lwd=2)
points(4,pc[40],col="red",pch=10)
a<-c(4,4)
d<-c(pc[40],pc[40]-(pc2[40]-pc[40]))
lines(a,d,col="blue")
par(lty=4,lwd=2)
e<-c(4,4.7);f<-c(pc[40]-(pc2[40]-pc[40]),pc[40]-(pc2[40]-pc[40]))
lines(e,f,col="blue")
#notion1
par(lty=2,lwd=2);abline(v=0.9,col="red3")
par(lty=1,lwd=3.5); arrows(2,1050,0.9,1000,lwd = 0.5,angle = 10,length = 0.15);text(2.1,1050,"A",cex=1.5)
arrows(2,pc[20],2,pc2[20],length = 0.15,angle = 20,lty = 1,lwd = 2,col = "red")
arrows(3,pc[30],3,pc2[30],length = 0.15,angle = 20,lty = 1,lwd = 2,col = "red")
arrows(4,pc[40],4,pc2[40],length = 0.15,angle = 20,lty = 1,lwd = 2,col = "red")
arrows(5,pc[50],5,pc2[50],length = 0.08,angle = 20,lty = 1,lwd = 2,col = "red")
arrows(6,pc[60],6,pc2[60],length = 0.08,angle = 20,lty = 1,lwd = 2,col = "red")
arrows(7,pc[70],7,pc2[70],length = 0.06,angle = 20,lty = 1,lwd = 2,col = "red")
arrows(8,pc[80],8,pc2[80],length = 0.04,angle = 20,lty = 1,lwd = 2,col = "red")
#notion2
par(lty=1,lwd=1)
text(3.9,pc2[40]+30,"a",cex=1.2,col="darkorange4"); points(4,pc2[40],col="black",pch=16)
text(3.9,pc[40]-5,"b",cex=1.2,col="darkorange4"); points(4,pc[40],col="black",pch=16)
text(3.9,pc[40]-(pc2[40]-pc[40])-25,"c",cex=1.2,col="darkorange4"); points(4,pc[40]-(pc2[40]-pc[40]),col="black",pch=16)
text(4.7,pc[47]-25,"d",cex=1.2,col="darkorange4"); points(4.7,pc[47],col="black",pch=16)
私は絵の凡例の「赤い矢印」を追加したいが、どのように私は行うことができますか?
ようこそStackOvervlow。 [再現可能な例]を与えてください(http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)。プロットのデータを提供できますか? 'dput()'はそれを助けます。 – loki