smurd
smurd

Reputation: 233

Change spacing in Mayavi

I am creating a surf() plot using Mayavi/mlab but the resluting picture is not really satisfying since the spacing is not really good. Here is my Code:

import pygrib
from mayavi.mlab import *
from mayavi import mlab

grbs = pygrib.open("lfff00000000c_1h.grb")
data = grbs.select(name='Geometric Height of the earths surface above sea level')[0].values
# --> data is a simple 2D array

mlab.figure(1, fgcolor=(0,0,0), bgcolor=(1,1,1))
s = surf(data, colormap='gist_earth')
mlab.title("geom. height", size = 0.5)

So actually i want to increase the spacing for the x and y axis in the resulting picture. But i don't know how to do this. I know that I somehow have to work with array_source.spacing = array([ 5., 5., 1.]) in my Python Code but i don't know how? :(

Upvotes: 1

Views: 310

Answers (1)

smurd
smurd

Reputation: 233

Actually i figured out what solves my problem: I simply added warp_scale to my surf() function. In this way the z-scale is influenced and since I was only interested in changing the x and y-axis in the same way this solves my problem.

s = surf(data, colormap='gist_earth', warp_scale=0.05)

Perhaps this helps other people with the same issue.

Upvotes: 1

Related Questions