Kitchi
Kitchi

Reputation: 1904

Disable points scaling in 3D scatter plots in Mayavi

The mayavi module for Python has a 3D scatter plotting function. By default the size of the points are scaled with the data (as far as I could understand from going through their website). This is what a screencap of my data looks like:

Mayavi Point Scatter

The colormap indicates the value of each point, so I don't require the size of the point to also scale with the value of the point. Is there any way to disable scaling of size?

Upvotes: 3

Views: 1448

Answers (1)

Warren Weckesser
Warren Weckesser

Reputation: 114946

The function mayavi.mlab.points3d has the scale_mode argument which 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:

screenshot

Upvotes: 7

Related Questions