【发布时间】:2020-11-05 01:54:15
【问题描述】:
我有一个数据框dat,我用它来生成不同地点的不同天气条件(列)的雷达图(由每一行表示为 arc1045、arc1047 ...)添加数据框的前两行以指示每种气候条件的最大值和最小值如下here
ambient_air_temperature relative_humidy barometric_pressure average_wind_speed particulate_density_2.5 particulate_density_10
1 85.000000 100.0000 2000.000 160.000000 999.900000 1999.90000
2 -40.000000 0.0000 10.000 0.000000 0.000000 0.00000
arc1045 9.176667 71.0700 1013.167 4.043333 5.133333 25.16667
arc1047 8.492500 80.9600 1014.000 2.035000 5.600000 25.10000
arc1048 8.477500 76.9875 1012.675 6.842500 6.275000 28.15000
arc1050 8.475000 76.5525 1013.775 6.335000 5.175000 30.20000
然后我按照here 描述的方法生成要作为标记包含在传单地图上的地块的 URI
library(fmsb)
makePlotURI <- function(expr, width, height, ...) {
pngFile <- plotPNG(function() { expr }, width = width, height = height, ...)
on.exit(unlink(pngFile))
base64 <- httpuv::rawToBase64(readBin(pngFile, raw(1), file.size(pngFile)))
paste0("data:image/png;base64,", base64)
}
rep(makePlotURI(radarchart(dat), 300, 300, bg = "transparent"), 4)
但是,这里的每个雷达图都包含多个多边形,每个多边形代表一个站点。我希望每个雷达图都有一个多边形并可视化单个站点上的天气状况。
【问题讨论】:
标签: r radar-chart