I need to plot a scalar field that is structured in a 3D grid as the one that follows:
import numpy as np
from mayavi import mlab
dt = 10
X,Y,Z = np.mgrid[0:dt,0:dt,0:dt]
F = X**2+Y**2+Z**2
test = mlab.figure(size = (1024,768), bgcolor = (1,1,1), fgcolor = (0, 0, 0))
sf = mlab.pipeline.scalar_field(X,Y,Z,F)
vl = mlab.pipeline.volume(sf)
mlab.outline()
mlab.axes()
mlab.title('Can not change font size for this title')
mlab.xlabel('Only end ticks')
mlab.ylabel('No major ticks')
I would like to do so in Python since I simulate many datasets in this language and I would like to be able to visualize them quickly as I perform sensitivities in my simulation parameters.
Mayavi seemed to offer pretty standard routines for scientific 3d plotting. However, when it comes to communicate these plots in publications, very basic plot customizations are not available such as major and minor ticks in the axes. Also, those very basic features that are supported do not even work properly to date (e.g. see example in font size bug and here).
Is there any decent and easy to use scientific 3D plotting library in Python? I have tried learning vtk but the website examples seem to be obsolete (e.g. volume rendering example that fails to run, I tried editing many lines of code to make it work without luck) and others seem to agree that the documentation is lacking.
By decent scientific plotting library I mean the following:
- Allows for customizing fonts in axes, labels, titles, etc.
- Can edit axes ticks spacing (with major ticks at the very least).
- Can add colorbars
- Has documentation.