Hi there,
I've got a a pylab 2D array which I plot using imshow() which just works
fine. But part of the data within the array is not to be considered nor
plotted. To keep it simple let's assume the data I need is shaped like a
triangle. It is no problem to extract the data from the matrix
converting the matrix to a list and dropping all unnecessary data.
My problem is that I don't know how to plot the data again. A possible
work around would be to set data elements which I don't need to some
value not in the data. But I since I need to compute histograms for the
data, for example, I have to drop the data anyways. Is there a way to
solve my problem?
Thanks for your help.
Cheers,
Torsten
Hi Torsten,
Use NumPy masked arrays with imshow()
[http://docs.scipy.org/doc/numpy/reference/maskedarray.html\]. You can
use the masked array just as you have been using your regular NumPy
array, they are designed for this purpose and Matplotlib will not plot
the masked portion of your data.
The pylab interface actually imports numpy so your pylab array is
really a NumPy ndarray object (try calling >>> print
type(your_pylab_array) to see this).
Cheers,
Scott
···
On 1 February 2010 11:34, Torsten Andre <qa@...2949...> wrote:
I've got a a pylab 2D array which I plot using imshow() which just works
fine. But part of the data within the array is not to be considered nor
plotted.
My problem is that I don't know how to plot the data again.