Skip to content

Filling under the lines for 3D-Plots in R #1179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
turgutrcaglar opened this issue Jan 13, 2018 · 5 comments
Closed

Filling under the lines for 3D-Plots in R #1179

turgutrcaglar opened this issue Jan 13, 2018 · 5 comments

Comments

@turgutrcaglar
Copy link

I would like to plot a 3D-Line Plot with Plotly in R for time-series and fill the areas under the every lines. I have an example code here.

library(plotly)

dens <- with(diamonds, tapply(price, INDEX = cut, density))
data <- data.frame(
  x = unlist(lapply(dens, "[[", "x")),
  y = unlist(lapply(dens, "[[", "y")),
  cut = rep(names(dens), each = length(dens[[1]]$x)))

p <- plot_ly(data, x = ~cut, y = ~x, z = ~y, type = 'scatter3d', mode = 'lines', color = ~cut)
p

with this code I can produce this plot

bildschirmfoto 2017-12-16 um 19 01 58

To fill the areas I have already tried setting surfaceaxis=0, 1, or 2 and they produced wrong fillings.

Here is the 3D-Plotly with wrong filling
bildschirmfoto 2017-12-16 um 19 11 09

To make an area plot with interior filling for 2D man can set "fill" to "tonexty". But it does not work for 3D-Plots

Is it a bug for 3D-Plots or am I missing something? Thanks in advance

@cpsievert
Copy link
Collaborator

'scatter3d' doesn't yet support fill attributes...this would have to be added at the plotly.js level. Moving the issue here plotly/plotly.js#2352

@cpsievert
Copy link
Collaborator

By the way, you can achieve something similar with 3d surfaces https://plot.ly/python/3d-filled-line-plots/

@turgutrcaglar
Copy link
Author

I have already seen and tried that. I think, it does not fill under the lines. If you look at the plot carefully for the lines "China" and "India", you can notice it. If the lines are linear during the x-axis, they can be filled with "tonexty" in R without problem. By the way, thank you for your interest.

@ak868308
Copy link

Anyone found solution please update here :( for plotly.js

@R-Lionheart
Copy link

Solution would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants