Skip to content

Commit d7a75c8

Browse files
committed
center lighting and turn off surface contour hover highlights
1 parent e2cbb56 commit d7a75c8

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

demo/sf-plotly-3D-globe.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ empty_axis <- list(
2626
title = ""
2727
)
2828

29+
# for centering camera/lighting on the center of the storm paths
30+
xyzmean <- list(x = .41, y = -.71, z = 0.57)
31+
2932
# A 3D globe implemented with 3D lines and a spherical surface
3033
# Note that the globe has a radius of 1, but project the lines with
3134
# a radius of 1.001 so that we appear on top of the surface
@@ -56,7 +59,13 @@ globe <- plot_ly(height = 500) %>%
5659
# NOTE: you can map a value to surfacecolor to encode, say air temp..
5760
# TODO: perhaps there is a better way to specify a constant surfacecolor?
5861
colorscale = list(c(0, "white"), c(1, "white")),
59-
showscale = FALSE, hoverinfo = "none"
62+
showscale = FALSE, hoverinfo = "skip",
63+
lightposition = xyzmean,
64+
contours = list(
65+
x = list(highlight = FALSE),
66+
y = list(highlight = FALSE),
67+
z = list(highlight = FALSE)
68+
)
6069
) %>%
6170
layout(
6271
showlegend = FALSE,
@@ -65,7 +74,7 @@ globe <- plot_ly(height = 500) %>%
6574
yaxis = empty_axis,
6675
zaxis = empty_axis,
6776
aspectratio = list(x = 1, y = 1, z = 1),
68-
camera = list(eye = list(x = .41, y = -.71, z = 0.57))
77+
camera = list(eye = xyzmean)
6978
)
7079
)
7180

0 commit comments

Comments
 (0)