Reputation: 121
How do you get the colorscale to be appropriate to the numbers? The highest point is at 2000, and should be blue in this case but the higher values are in red which should be for the lower numbers. An example dataframe and code are below.
test <- data.frame(a = c(10,20,15,30,45,40,20,30,25,30,10,40,10,20,15),
b = c(5,10,5,15,10,20,20,15,10,5,15,20,5,10,5),
c = c(500, 1000,1250, 750,575,200,800,2000,1500,1750,250,750,1000,800,500))
plot_ly(data = test,
x = ~a,
y = ~b,
z = ~c,
intensity = seq(0,2000, length = 8),
colorscale = list(c(0,'rgb(255,0,0)'),
c(0.5, 'rgb(0,255,0)'),
c(1, 'rgb(0,0,255)')),
type = 'mesh3d')
Ideally, the color scale would be even more specific where 0-500 is red, 501-1000 is orange, 1001-1500 is yellow, and 1501-2000 would be green instead of a scale.
Upvotes: 2
Views: 1308
Reputation: 1854
Perhaps this is what you need:
plot_ly(data = test,
x = ~a,
y = ~b,
z = ~c,
intensity = ~c,
colorscale = list(c(0,'red'),
c(0.33,'orange'),
c(0.66, 'yellow'),
c(1, 'green')),
type = 'mesh3d')
Upvotes: 4