def test_mayaxes(): from mayaxes import mayaxes from scipy import sqrt,sin,meshgrid,linspace,pi import mayavi.mlab as mlab resolution = 200 lambda_var = 3 theta = linspace(-lambda_var*2*pi,lambda_var*2*pi,resolution) x, y = meshgrid(theta, theta) r = sqrt(x**2 + y**2) z = sin(r)/r fig = mlab.figure(size=(1024,768)) surf = mlab.surf(theta,theta,z,colormap='jet',opacity=1.0,warp_scale='auto') mayaxes(title_string='Figure 1: Diminishing polar cosine series', \ xlabel='X data',ylabel='Y data',zlabel='Z data',handle=surf) fig.scene.camera.position = [435.4093863309094, 434.1268937227623, 315.90311468125287] fig.scene.camera.focal_point = [94.434632665253829, 93.152140057106593, -25.071638984402856] fig.scene.camera.view_angle = 30.0 fig.scene.camera.view_up = [0.0, 0.0, 1.0] fig.scene.camera.clipping_range = [287.45231734040635, 973.59247058049255] fig.scene.camera.compute_view_plane_normal() fig.scene.render() mlab.show()
def test_mayaxes(): from mayaxes import mayaxes from scipy import sqrt, sin, meshgrid, linspace, pi import mayavi.mlab as mlab resolution = 200 lambda_var = 3 theta = linspace(-lambda_var * 2 * pi, lambda_var * 2 * pi, resolution) x, y = meshgrid(theta, theta) r = sqrt(x**2 + y**2) z = sin(r) / r fig = mlab.figure(size=(1024, 768)) surf = mlab.surf(theta, theta, z, colormap='jet', opacity=1.0, warp_scale='auto') mayaxes(title_string='Figure 1: Diminishing polar cosine series', \ xlabel='X data',ylabel='Y data',zlabel='Z data',handle=surf) fig.scene.camera.position = [ 435.4093863309094, 434.1268937227623, 315.90311468125287 ] fig.scene.camera.focal_point = [ 94.434632665253829, 93.152140057106593, -25.071638984402856 ] fig.scene.camera.view_angle = 30.0 fig.scene.camera.view_up = [0.0, 0.0, 1.0] fig.scene.camera.clipping_range = [287.45231734040635, 973.59247058049255] fig.scene.camera.compute_view_plane_normal() fig.scene.render() mlab.show()
# -*- coding: utf-8 -*- """ Created on Tue May 28 12:20:59 2013 === MAYAXES (v1.1) === Generates a set of MayaVI axes using the mayavi.mlab.axes() object with a white background, small black text and a centred title. Designed to better mimic MATLAB style plots. Unspecified arguments will be set to default values when mayaxes is called (note that default settings are configured for a figure measuring 1024 x 768 pixels and may not display correctly on plots that are significantly larger or smaller). === Inputs === 'title' Figure title text (default = 'VOID') 'xlabel' X axis label text (default = 'X') 'ylabel' Y axis label text (default = 'Y') 'zlabel' Z axis label text (default = 'Z') 'handle' Graphics handle of object (if bounding box is to be plotted) 'title_size' Font size of the title text (default = 25) 'ticks' Number of divisions on each axis (default = 7) 'font_scaling' Font scaling factor for axis text (default = 0.7) 'background' Background colour (can be 'b' (black) or 'w' (white)) === Notes === Disbaling figure title: specify title_string='void' OR title_string='Void' OR title_string='VOID' to disable figure title. Disabling bounding box: specify handle='void' OR handle='Void' OR handle='VOID' to disable figure bounding box.