# Thu Oct 15 11:01:21 2020 -
# 字符编码:UTF-8
# R 版本:R x64 4.0.2 for window 10
# cgh163email@163.com
# 个人笔记不负责任
# —— 拎了个梨🍐
.rs.restartR()
rm(list=ls());gc()
# render_label函数,插个柱子
require(rayshader)
sphere_shade(montereybay) %>%
plot_3d(montereybay,zscale=50,water=TRUE, watercolor="#FF33CC") # 水的颜色
render_snapshot(clear = T)
# Thu Oct 15 11:23:40 2020 --
santa_cruz = c(36.962957, -122.021033)
dev.copy(png, "插个柱子.jpg", width = 400, height = 400);dev.off()
# 保存当前显示的图像
#我们想为圣克鲁斯添加标签,所以我们使用x和y矩阵坐标(x = 220和y = 330)
render_label(montereybay,lat = santa_cruz[1], long = santa_cruz[2],
extent = attr(montereybay, "extent"),
altitude=12000, zscale=50, text = "Santa Cruz") # 加个标签
render_snapshot()
monterey = c(36.603053, -121.892933)
# 我们还可以通过设置'dashed = TRUE'将线型更改为虚线(其他选项允许#用户控制虚线长度)。 您可以通过设置#`clear_previous = TRUE来清除现有行。
render_label(montereybay, lat = monterey[1], long = monterey[2], altitude = 10000,
extent = attr(montereybay, "extent"),
zscale = 50, text = "Monterey", textcolor = "white", linecolor="darkred",
dashed = TRUE, clear_previous = TRUE) # 插个虚线
dev.copy(png, "插个虚线柱子.jpg", width = 400, height = 400);dev.off()
# 保存当前显示的图像
render_snapshot()
canyon = c(36.621049, -122.333912)
# 缺省情况下,z表示海拔矩阵上该点上方的高度。我们也可以指定
# 通过设置 "relativez=FALSE "得到一个绝对高度。
render_label(montereybay,lat=canyon[1], long = canyon[2], altitude = 2000,
extent = attr(montereybay,"extent"),
zscale=50,text = "Monterey Canyon", relativez=FALSE)
render_snapshot()
# 我们还可以使用`render_highquality()`指定自定义的#line半径来高质量渲染标签。 默认情况下,标签指向相机,但是您可以使用#argument`text_angle`固定标签的角度。
render_camera(theta=35, phi = 35, zoom = 0.80, fov=60)
render_label(montereybay, lat = monterey[1], long = monterey[2], altitude = 10000,
extent = attr(montereybay, "extent"),
zscale = 50, text = "Monterey", textcolor = "white", linecolor="darkred",
dashed = TRUE, clear_previous = TRUE)
render_label(montereybay,lat=canyon[1], long = canyon[2], altitude = 2000, zscale=50,
extent = attr(montereybay,"extent"), textcolor = "white", linecolor="white",
text = "Monterey Canyon", relativez=FALSE)
render_highquality(samples=200,text_size = 24, line_radius = 2, text_offset = c(0,20,0),
lightdirection=180, clamp_value=10)
#Fixed text angle
render_highquality(samples=200,text_size = 24, line_radius = 2, text_offset = c(0,20,0),
lightdirection=180, text_angle=0, clamp_value=10)
# 通过调用`render_label(clear_previous = TRUE)删除所有现有标签
render_label(clear_previous = TRUE)
render_snapshot()
rgl::rgl.close()
R语言,rayshader包,render_label函数,插个柱子
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...