This is awesome! On Mon, Jun 25, 2012 at 5:27 AM, klo uo <[email protected]> wrote:
> I was reading mayavi documentation and one of the examples > (tvtk.ImageData) resembled Numpy logo grid. > I added barchart and tweaked a bit colormap and thought to post it for fun: > > ======================================== > import numpy as np > from tvtk.api import tvtk > from mayavi import mlab > > def view(dataset): > fig = mlab.figure(bgcolor=(1, 1, 1), fgcolor=(0, 0, 0), > figure=dataset.class_name[3:]) > surf = mlab.pipeline.surface(dataset, opacity=0.2) > mlab.pipeline.surface(mlab.pipeline.extract_edges(surf), color=(0, > 0, 0), line_width=.1 ) > mlab.barchart(n, extent=[0.05, 4.5, 0.05, 4.5, -.35, 1]) > > n=([[1,0,0,1], [1,0,1,1], [1,1,0,1], [1,0,0,1]]) > > data = np.random.random((5, 5, 5)) > i = tvtk.ImageData(spacing=(1, 1, 1), origin=(0, 0, 0)) > i.point_data.scalars = data.ravel() > i.point_data.scalars.name = 'scalars' > i.dimensions = data.shape > > view(i) > ======================================== > > > Cheers > > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > >
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
