Black Lives Matter. Please consider donating to Black Girls Code today.

Combining mesh3d and scatter3d in R

Hi.

I’m doing a mesh3d plot, with many different mesh3d traces that combine into one object. Each of these traces is provided its own colour for facecolor.

I also want a colorbar that spans all the traces colors. Intensity wont work for me in this case.

What I’m trying to do, it have a scatter3d trace with visible='legendonly' that would provide the colorbar, and then have the mesh3d traces added to that.

Unfortunately that does not seem to work very well.

I’m running into the same issue as here, and am wondering how to translate this approach into R.