比例尺(跟欄桿似的)
多條欄桿
分為三段和多條欄桿
長短和不同色彩欄桿
# Thu Oct 15 17:09:21 2020 -
# 字符編碼:UTF-8
# R 版本:R x64 4.0.2 for window 10
# cgh163email@163.com
# 個人筆記不負(fù)責(zé)任
# —— 拎了個梨??
.rs.restartR()
rm(list=ls());gc()
# render_scalebar函數(shù),比例尺
require(rayshader)
# 在地圖上放置指南針以指定北向黑低。
#Add a scale bar to the montereybay dataset, here representing about 80km
## Not run:
montereybay %>%
sphere_shade() %>%
plot_3d(montereybay,theta=45, water=TRUE)
render_scalebar(limits=c(0, 80), label_unit = "km")
render_snapshot()
dev.copy(png,'比例尺(跟欄桿似的).jpg');dev.off()
#支持高質(zhì)量渲染:
render_highquality(lightdirection=250, lightaltitude=40, scale_text_size=24,clamp_value=10)
render_scalebar(clear_scalebar = TRUE)
#我們可以通過將基本方向指定為“ position”來更改位置赘艳,并通過設(shè)置“ color_first”和“ color_second”來設(shè)置#color
render_scalebar(limits=c(0,80), label_unit = "km", position = "N",
color_first = "darkgreen", color_second = "lightgreen")
render_snapshot()
render_scalebar(clear_scalebar = TRUE)
dev.copy(png,'多條欄桿.jpg');dev.off()
#通過設(shè)置“ text_switch_side = TRUE”來切換方向
render_scalebar(limits=c(0,80), label_unit = "km", position = "N", text_switch_side = TRUE,
color_first = "darkgreen", color_second = "lightgreen")
render_snapshot()
render_scalebar(clear_scalebar = TRUE)
#我們可以通過在“限制”中指定其他距離來添加其他休息時間
render_scalebar(limits=c(0,40,80), label_unit = "km")
render_snapshot()
render_scalebar(clear_scalebar = TRUE)
dev.copy(png,'分為三段和多條欄桿.jpg');dev.off()
#我們還可以通過設(shè)置y參數(shù)來手動指定高度:
render_scalebar(limits=c(0,40,80), y=-70, label_unit = "km")
render_snapshot()
render_scalebar(clear_scalebar = TRUE)
#在這里酌毡,我們通過在側(cè)面指定起點和終點來更改總大小,#并設(shè)置彩色的“ segments”的數(shù)量:
render_scalebar(limits=c(0,20, 40), segments = 4, scale_length = c(0.5,1), label_unit = "km")
render_scalebar(limits=c(0,20, 40), segments = 4, position = "N", text_switch_side = TRUE,
scale_length = c(0.25,0.75), label_unit = "km")
render_snapshot()
render_scalebar(clear_scalebar = TRUE)
dev.copy(png,'長短和不同色彩欄桿.jpg');dev.off()
#用“ radius”更改比例尺的半徑蕾管。 在這里枷踏,自動定位不適用于#the標(biāo)簽,因此我們提供了帶有`text_y_offset`和`text_x_offset`的附加偏移量以對其進(jìn)行修復(fù)掰曾。
render_scalebar(limits=c(0,20, 40), segments = 4, scale_length = c(0.5,1),
label_unit = "km", radius=10,text_y_offset=-20,text_x_offset=20)
render_snapshot(clear=TRUE)
dev.copy(png,'更粗的欄桿.jpg');dev.off()