Disable scaling points in 3D scatterplots in Mayavi
The mayavi
Python module has a 3D scatter plotting function. By default, the size of the glasses is scaled with the data (as far as I could understand while browsing their website). This is how my data screencap looks like:
The color palette indicates the value of each point, so I don't require the point size to scale with the point value as well. Is there a way to turn off size scaling?
+3
source to share
1 answer
The function mayavi.mlab.points3d
has an argument scale_mode
that can be set to 'none'
.
For example:
In [23]: t = linspace(0, 4*numpy.pi, 20)
In [24]: x = sin(2*t)
In [25]: y = cos(t)
In [26]: z = cos(2*t)
In [27]: s = 2 + sin(t)
In [28]: mlab.points3d(x, y, z, s, colormap="copper", scale_mode='none')
Out[28]: <mayavi.modules.glyph.Glyph at 0x9fd85f0>
Here's a screenshot of the plot:
+7
source to share