R光线着色器提升了Us贴图和点
我正在尝试创建一个基于美国地图的stl文件,该文件具有不同的位置,如点,以及基于数据值的不同高度 我可以相对容易地创建点部分R光线着色器提升了Us贴图和点,r,ggplot2,geospatial,rayshader,R,Ggplot2,Geospatial,Rayshader,我正在尝试创建一个基于美国地图的stl文件,该文件具有不同的位置,如点,以及基于数据值的不同高度 我可以相对容易地创建点部分 library(ggplot2) library(data.table) library(rayshader) myPoints <- structure(list(N = c(7.34e+20, 1e+18, 1.471e+21, 1.35e+21, 2.096e+21 ), latitude = c(35.060137, 42.151816, 34.42098
library(ggplot2)
library(data.table)
library(rayshader)
myPoints <- structure(list(N = c(7.34e+20, 1e+18, 1.471e+21, 1.35e+21, 2.096e+21
), latitude = c(35.060137, 42.151816, 34.420986, 39.713209, 32.445652
), longitude = c(-93.133718, -71.77203, -92.530547, -75.661478,
-93.739031)), row.names = c(NA, -5L),
class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x0000000006431ef0>)
gg1 <- ggplot() +
geom_map(data = us, map = us, aes(x = long, y = lat, map_id = region),
fill = "#ffffff", color = "#ffffff", size = 0.15) +
geom_point(data = test, aes(x = longitude, y = latitude, color = N), inherit.aes = F) +
theme(legend.position = "none")
gg1
plot_gg(gg1, multicore = TRUE, width = 5, height = 5, scale = 250, windowsize = c(1400,866),
zoom = 0.55, phi = 30)
库(ggplot2)
库(数据表)
库(光线着色器)
myPoints我花了一些时间学习这个很酷的软件包,因为直到看到这个问题我才知道它。据我从目前的CRAN手册(版本0.13.2)中了解,我认为您无法生成所需的图形。在CRAN手册(第15页)中,您可以看到一个名为height\u aes
的参数
默认值为“NULL”。高度值应使用“填充”还是“颜色”,用户可以通过将“填充”或“颜色”传递到此参数来指定高度值。自动检测。如果“填充”和“颜色”美学都存在,则默认为“填充”
如您所见,您可以使用fill
或color
在图形中创建高度。默认情况下,plot_gg()
为高度选择fill
。因此,您看到多边形正在升高,而点没有升高。目前,我认为在制作图形时,你必须选择其中一种美学。让我们拭目以待,看看我们是否能够使多边形和条形都成为3D 啊,我真傻,我在手册里没看到。好了,是时候学习如何制作矩阵了:)谢谢你。@jamesholl,不客气。多亏了你,我才有机会学习这个软件包!
us <- map_data("state")
arr <- USArrests %>%
rownames_to_column("region") %>%
mutate(region = tolower(region))
arr$Murder <- 0.01
gg2 <- ggplot() +
geom_map(data = us, map = us, aes(x = long, y = lat, map_id = region),
fill = "#ffffff", color = "#ffffff", size = 0.15) +
geom_map(data = arr, map = us, aes(fill = Murder, map_id = region), color = "#ffffff") +
geom_point(data = test, aes(x = longitude, y = latitude, color = N), inherit.aes = F) +
theme(legend.position = "none")
gg2
plot_gg(gg2, multicore = TRUE, width = 5, height = 5, scale = 250, windowsize = c(1400,866),
zoom = 0.55, phi = 30)