0

I am displaying some volumetric scalar data and quickly rendering the scene and saving the results to a png. This all works fine. However if I add some helpful objects such as a scalarbar or even axes to the figure it only renders the newly added scalarbar or axes.

An example,

import numpy as np
from mayavi import mlab

x, y, z = np.ogrid[-10:10:20j, -10:10:20j, -10:10:20j]
s = np.sin(x*y*z)/(x*y*z)

mlab.options.offscreen = True
fig = mlab.figure(1, bgcolor=(1., 1., 1.), size=(500, 500))
fig.scene.anti_aliasing_frames = 0

mlab.pipeline.volume(mlab.pipeline.scalar_field(s))
mlab.scalarbar() # commenting this out correctly renders, but no scalarbar

mlab.savefig('test.png')

This is actually used to create an animation, so I need to render offscreen. How can I display the volumetric data and the scalarbar?

abnowack
  • 370
  • 1
  • 13
  • What version of mayavi are you using? – aestrivex Mar 06 '14 at 18:23
  • 4.3.1, It was installed through the Anaconda Python distribution under Fedora-20 64-bit Linux – abnowack Mar 06 '14 at 19:36
  • 1
    Hmm.. I am unable to reproduce the problem by running your code snippet; the axes and colorbar show up correctly in the output figure (I added `mlab.axes(color=(0,0,0))`). There were some improvements and bugfixes to offscreen rendering in 4.3.1, so I figured that might be the cause. – aestrivex Mar 06 '14 at 21:57
  • How are you running it? I was just calling 'python script.py' – abnowack Mar 06 '14 at 22:15
  • Okay, using mayavi isn't much different. I'll wait until 4.3.2 hits pypi – abnowack Mar 06 '14 at 22:38
  • That is how I was running it as well. The fixes should be present in 4.3.1. The only thing I can think of is that it may be possible that it is some obscure graphics driver error. – aestrivex Mar 07 '14 at 16:36

0 Answers0