# NOT RUN {
montereybay %>%
sphere_shade() %>%
plot_3d(montereybay,zscale=50,water=TRUE, watercolor="#233aa1")
render_snapshot()
# }
# NOT RUN {
santa_cruz = c(36.962957, -122.021033)
#We want to add a label to Santa Cruz, so we use the x and y matrix coordinate (x=220 and y=330)
# }
# NOT RUN {
render_label(montereybay,lat = santa_cruz[1], long = santa_cruz[2],
extent = attr(montereybay, "extent"),
altitude=12000, zscale=50, text = "Santa Cruz")
render_snapshot()
# }
# NOT RUN {
monterey = c(36.603053, -121.892933)
#We can also change the linetype to dashed by setting `dashed = TRUE` (additional options allow
#the user to control the dash length). You can clear the existing lines by setting
#`clear_previous = TRUE`.
# }
# NOT RUN {
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_snapshot()
# }
# NOT RUN {
canyon = c(36.621049, -122.333912)
#By default, z specifies the altitude above that point on the elevation matrix. We can also specify
#an absolute height by setting `relativez=FALSE`.
# }
# NOT RUN {
render_label(montereybay,lat=canyon[1], long = canyon[2], altitude = 2000,
extent = attr(montereybay,"extent"),
zscale=50,text = "Monterey Canyon", relativez=FALSE)
render_snapshot()
# }
# NOT RUN {
#We can also render labels in high quality with `render_highquality()`, specifying a custom
#line radius. By default, the labels point towards the camera, but you can fix their angle with
#argument `text_angle`.
# }
# NOT RUN {
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)
# }
# NOT RUN {
#We can remove all existing labels by calling `render_label(clear_previous = TRUE)`
# }
# NOT RUN {
render_label(clear_previous = TRUE)
render_snapshot()
rgl::rgl.close()
# }
Run the code above in your browser using DataLab