0
votes

I'm creating a graph via Plotly, the type is mesh3d. However, I have a problem. My graph is brown and I can't seem to change it. You can see in my third line, that I specified the color red, however, it has no effect on my graph. Regardless of what I set, the graph is always brown.

graph<- plot_ly(data)%>%
add_trace(x = ~date, y = ~variable, z = ~value, color = ~variable, split=~variable, mode="lines") %>%
add_trace(x = ~date, y = ~variable, z = ~value, type="mesh3d", color = I("white"))

> data
    date variable value
1      2        1  4.36
2      3        1  4.34
3      4        1  4.33
4      7        1  4.34
5      8        1  4.32
6      9        1  4.34
7     10        1  4.32
8     11        1  4.31
9     14        1  4.28
10    15        1  4.23
11    16        1  4.20
12    17        1  4.24
13    18        1  4.19
14    21        1  4.18
...   ...       ..  ....

How do I change the color?

1
Please add some sample reproducible data, as usually desired - AnilGoyal
@AnilGoyal Edited the post. - user15164073
Excuse me, where can we find "red" in your third line? - pascal

1 Answers

0
votes

You might want to define your colors in the plot_ly() command. In the case of you maybe wanting a red line:

graph<- plot_ly(data, colors="red")%>%
     add_trace(x = ~date, y = ~variable, z = ~value, color = ~variable, split=~variable, mode="lines") %>%
     add_trace(x = ~date, y = ~variable, z = ~value, type="mesh3d", color = I("white"))