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
Mayavi does not support RGB tuples as point data #92
Comments
The core devs of Mayavi are quite busy elsewhere. I am afraid that for |
Thats quite all right. I intended it as a feature request for the future, I know it is a considerable amount of work. It is something I would try to work on, if I can find time. |
Thanks a lot for being so understanding. Quite clearly the workforce on |
@GaelVaroquaux there will be some funding on the project soon (starting Q2 next year) ! |
I have been banging my head against this particular wall for most of today -- specifying a list of points in terms of arrays of [x, y, z, size, color] seems like such an obvious feature! Why would anyone want the size of points to be locked to the color of points?! |
Your set of requirements may that be that of others. Mayavi is built upon That said, decoupling size and color is easily possible with a bit of a |
Thanks for the quick reply. Unfortunately, it is a major limitation in terms of Mayavi's ability to plot scientific data (see e.g. this thread, featuring the quote "I also took the fetal position and started weeping after I realise the API doesn't have any clear/default way of custom colours", which summarizes my feeling exactly!). It seems the feature is possible in VTK (e.g., this), although it may not be easy to translate to Mayavi. (Incidentally, it sounds like you'd be familiar with what I'm trying to do here -- I want to use different colors for each different population of neurons in a 3D model of the cortex.) |
Hi Cliff, There's no nice api for this, but there are some workarounds to do it. Either by using a tvtk unsigned char array as I initially suggested here (see Or by setting up a large colortable which holds every possible RGB value. (see answer by user eqzx, On Fri, May 15, 2015 at 1:26 PM, Cliff Kerr notifications@github.com
|
Neither of those answers on their own really did what I wanted, but finally I figured it out by combining them :)
|
In pure vtk it is possible to have surfaces where point_data.scalars is a vtkUnsignedCharArray. The renderer will interpret this as providing a distinct RGB or RGBA value for each vertex and color the surface accordingly if the settings are set up. Mayavi objects do not let you do this at all because they don't ever set up vtkUnsignedCharArrays.
Eventually, it would be nice to have it so that if the user specifies valid RGB or RGBA tuples as scalars to mlab functions, the colors at each point would conform to the scalars.
The text was updated successfully, but these errors were encountered: