ylim在打印输出(WindR)中约束数据,但不约束轴
我正在学习WindR()的教程,并按照说明进行操作,但是当涉及到在地图上绘制数据时,纬度界限要比数据范围大得多。数据范围从20到60纬度,而地图输出的范围要大得多 将ylim参数调整为plot()不会改变数据显示:ylim在打印输出(WindR)中约束数据,但不约束轴,r,plot,R,Plot,我正在学习WindR()的教程,并按照说明进行操作,但是当涉及到在地图上绘制数据时,纬度界限要比数据范围大得多。数据范围从20到60纬度,而地图输出的范围要大得多 将ylim参数调整为plot()不会改变数据显示: # Finally, we can transform this data into a raster layer rmax <- rasterFromXYZ(maxw) acol <- colorRampPalette(c("white", "blue", "d
# Finally, we can transform this data into a raster layer
rmax <- rasterFromXYZ(maxw)
acol <- colorRampPalette(c("white", "blue", "darkblue"))
plot(rmax, col=acol(1000), main= "Maximum wind speed reported",
xlab="Longitude", ylab="Lattitude", ylim=c(20,60))
#add world map lines
lines(getMap(resolution = "high"), lwd=2)
最后,我们可以将这些数据转换为光栅图层
rmax
library(rWind)
library(lubridate)
library(dplyr)
library(rworldmap)
# Here, we use ymd_hms from lubridate package to create a sequence of dates
dt <- seq(ymd_hms(paste(2018,6,1,12,00,00, sep="-")),
ymd_hms(paste(2018,6,30,12,00,00, sep="-")),by="1 days")
# Now we can use wind.dl_2 with this sequence of dates. Have into account
# that it could take a while, they are 30 datasets and it's a big area.
ww <- wind.dl_2(dt,-85,5,20,60)
# After tidy our wind data, we can use dplyr utilities to easily
# obtain several metrics from our wind data. Notice that wind average
# is a special case, and it will be discussed later
t_ww <- tidy(ww)
g_ww <- t_ww %>% group_by(lat, lon)
# Now, we select only the maximum speed values for each coordinate
max_ww <- g_ww %>% summarise(speed = max(speed))
maxw <- cbind(max_ww$lon, max_ww$lat, max_ww$speed)
head(maxw)
# Finally, we can transform this data into a raster layer
rmax <- rasterFromXYZ(maxw)
acol <- colorRampPalette(c("white", "blue", "darkblue"))
plot(rmax, col=acol(1000), main= "Maximum wind speed reported",
xlab="Longitude", ylab="Lattitude", ylim=c(20,60))
#add world map lines
lines(getMap(resolution = "high"), lwd=2)