# NOT RUN {
#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()
#This function works with `render_highquality()`
render_highquality(lightdirection=250, lightaltitude=40, scale_text_size=24,clamp_value=10)
render_scalebar(clear_scalebar = TRUE)
#We can change the position by specifying a cardinal direction to `position`, and the
#color by setting `color_first` and `color_second`
render_scalebar(limits=c(0,80), label_unit = "km", position = "N",
color_first = "darkgreen", color_second = "lightgreen")
render_snapshot()
render_scalebar(clear_scalebar = TRUE)
#And switch the orientation by setting `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)
#We can add additional breaks by specifying additional distances in `limits`
render_scalebar(limits=c(0,40,80), label_unit = "km")
render_snapshot()
render_scalebar(clear_scalebar = TRUE)
#We can also manually specify the height by setting the `y` argument:
render_scalebar(limits=c(0,40,80), y=-70, label_unit = "km")
render_snapshot()
render_scalebar(clear_scalebar = TRUE)
#Here we change the total size by specifying a start and end point along the side,
#and set the number of colored `segments`:
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)
#Change the radius of the scale bar with `radius`. Here, the autopositioning doesn't work well with
#the labels, so we provide additional offsets with `text_y_offset` and `text_x_offset` to fix it.
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)
# }
Run the code above in your browser using DataLab