我想制作条形图,其中可以指定最小条形(很像盒子中的方框和胡须图).barplot可以做到吗?我怀疑ggplot中的答案,但我找不到一个例子.这是一些数据:
Run Code Online (Sandbox Code Playgroud)X Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 1 Highest recorded 31.5 31.8 30.3 28.0 24.9 24.4 21.7 20.9 24.5 25.4 26.0 28.7 2 Mean monthly maximum 27.8 28.6 27.0 24.8 22.0 20.0 18.9 18.8 20.4 22.4 23.9 26.8 3 Mean daily maximum 24.2 24.8 23.1 20.9 18.4 16.3 15.5 15.7 16.9 18.3 20.0 22.4 4 Mean 19.1 19.8 18.1 16.2 13.8 11.9 11.2 11.6 12.7 14.1 15.7 17.7 5 Mean daily minimum 14.0 …
我根据几年小时数据的数据框(球)进行昼夜风速循环.我想按季节绘制它们,所以我将我需要的日期分类并按照以下方式加入它们:
b8 = subset(ball, as.Date(date)>="2008-09-01 00:00:00, GMT" & as.Date(date)<= "2008-11-30 23:00:00, GMT" )
b9 = subset(ball, as.Date(date)>="2009-09-01 00:00:00, GMT" & as.Date(date)<= "2009-11-30 23:00:00, GMT" )
b10 = subset(ball, as.Date(date)>="2010-09-01 00:00:00, GMT" & as.Date(date)<= "2010-11-30 23:00:00, GMT")
ballspr = rbind(b8,b9,b10)
Run Code Online (Sandbox Code Playgroud)
然后我用这个得到一个昼夜循环:
sprwsdiurnal <- aggregate(ballspr["ws"], format(ballspr["date"],"%H"),summary, na.rm=T)
Run Code Online (Sandbox Code Playgroud)
对于四个季节中的三个季节,这使得具有这种结构的对象:
date ws
1 00 0.200, 1.000, 1.600, 2.021, 2.500, 8.000, 5.000
2 01 0.100, 1.000, 1.600, 1.988, 2.500, 8.600, 1.000
3 02 0.100, 1.000, 1.700, 1.982, 2.600, 8.900, 1.000
Run Code Online (Sandbox Code Playgroud)
......到24小时......
23 22 0.100, 1.200, …Run Code Online (Sandbox Code Playgroud)