我使用Mayavi/mlab创建了一个surf()图,但是重新生成的图片并不令人满意,因为间距不是很好。以下是我的代码:
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)所以实际上我想增加x和y轴在结果图片中的间距。但我不知道该怎么做。我知道我必须以某种方式使用array_source.spacing = array( 5.,5.,1.)在我的Python代码中,但是我不知道怎么做?:(
发布于 2014-11-17 18:12:12
实际上,我找到了解决问题的方法:我只需将warp_scale添加到我的surf()函数中。这样,z轴就会受到影响,因为我只对以同样的方式改变x轴和y轴感兴趣,这就解决了我的问题。
s = surf(data, colormap='gist_earth', warp_scale=0.05)也许这对其他有同样问题的人有帮助。
https://stackoverflow.com/questions/26969897
复制相似问题