0

I have 3 numpy arrays as follow:

import numpy as np
from mayavi import mlab

x = np.arange(0,101,1)
a = np.arange(0,51,1)
b = np.arange(51,76,0.5)
z = np.hstack((a,b))

y = np.zeros(x.shape)
values = np.random.random(x.shape)

They define a vertical plane that I would like to plot as a colormap. Any idea on how to do that using Mayavi and Python?

I tried different things based on the http://docs.enthought.com/mayavi/mayavi/auto/example_surface_from_irregular_data.html example but I am stuck with the fact that the plane is vertical...

Lee
  • 29,398
  • 28
  • 117
  • 170
rbeucher
  • 143
  • 8

1 Answers1

0

Perhaps I don't understand your question but I can't seem to pick out the 3D data that you describe; values is a 1D array in your code. So here is an example I made up:

import numpy as np
import matplotlib.pyplot as plt

If you have a 3D array of random data:

data = np.random.normal(loc=100,scale=10,size=(101,101,101))

And you want a colour map of a 2D slice, say at y=0, you can use imshow - no need for mayavi:

plt.imshow(data[:,0,:],cmap='Reds')

This gives (random noise in this case):

enter image description here

Lee
  • 29,398
  • 28
  • 117
  • 170