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

Can 3D scatter plots use custom shapes instead of points?

Is it possible to render a custom shape such as a cylinder or spheroid (an sphere stretched along one axis) instead of the circular markers for a trace on a 3D scatter plot? I appreciate that symbols from a predefined list / font can be used but I am looking at completely new polygons.

I have seen a reference to layout.shapes but can’t see how it would be used.

For example, this 3D scatter plot https://plot.ly/javascript/3d-scatter-plots/ with different custom shapes (not symbols) for the markers.

I’m happy to hack / extend as needed and submit changes to make this happen if it’s feasible.

Thanks in advance,

Ryan

Not at the moment unfortunately. We are planning on implement a streamtube shortly. Perhaps this corresponds to your use case.

I’m curious. How would you go about defining those shapes? Would their parameters be in pixel or (x,y,z) data space?

Streamtube looks like it would do it, possibly overkill for my needs though but I can see how something generic would be better.

I think I only currently need two simple shapes, a cylinder and a spheroid. These can be defined with vectors (as a marker currently is defined) with additional x-diameter, y-diameter and z-diameter properties which would hopefully enable me to create shapes such as those in the attached image. The black lines are the 3 new diameter properties.

The markers would need to differentiate between cylinder and sphere. They would all be upright in my use-case, so an orientation vector would not be required.

Being able to set the opacity of the shape would be useful.

Background: The x and z axis represent latitude and longitude and the y axis time. A small circle is an exact point in time / space. A cylinder represents an event that happens between two points in time and up to a certain distance in space from the centre of the cylinder. Happy to go into more detail, but I may bore you…

Is there anything I can do to contribute?

Spheroids

It’s a bit of a poor show this isn’t possible: points in 3D should be spheres, not circles (billboards). The reason is that if you have a 3D plot with both lines and plots, there’ll be no depth awareness, so the lines will clip the points in weird ways / the sorting will change as you move the camera. This makes the plot visually confusing.

If someone really wants to do this, it’d be possible with plotly’s Mesh plots, if you manually construct the sphere geometry yourself. I have no idea how performant this would be however, and would substantially increase the size of the graph data.