plotly / plotly/plotly.R

Large mesh3d plot is not displayed with R-4.4.0

Open
#2,352 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Hello,

Since I upgraded R to version 4.4.0, my mesh3d plot no longer appears. The viewer renders a blank page. This mesh is large and if I reduce it then it appears.

library(plotly)
library(rmarchingcubes)

R <- 2
f1 <- function(x, y, z){
  x^2 + y^2 + z^2 - R^2
}
f2 <- function(x, y, z){
  (x-2)^2 + (y-2)^2 + (z-2)^2 - R^2
}
g <- function(x, y, z) {
  pmax(f1(x, y, z), f2(x, y, z))
}

n <- 100
x_ <- y_ <- z_ <- seq(-R, R, length.out = n) 
Grid <- expand.grid(X = x_, Y = y_, Z = z_)
voxel <- with(Grid, array(g(X, Y, Z), dim = c(n, n, n)))
surf <- contour3d(voxel, level = 0, x_, y_, z_)
vertices <- surf$vertices
indices  <- surf$triangles - 1L

plot_ly(
  x = vertices[, 1], y = vertices[, 2], z = vertices[, 3],
  i = indices[, 1], j = indices[, 2], k = indices[, 3],
  type = "mesh3d"
) %>% layout(scene = list(aspectmode = "data"))

If you replace n <- 100 with n <- 50 then the expected plot appears.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided R reproduction using plotly, rmarchingcubes, and a mesh3d trace, comparing n = 100 with n = 50 under R 4.4.0. Investigate why the larger mesh produces a blank viewer, and verify completion when the n = 100 example renders the expected plot without changing the reported setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.