On Fri, Sep 14, 2012 at 2:51 PM, gsal <salger...@gmail.com> wrote:
> Hi, everybody:
>
> I don't have experience with images or contours and need some help plotting
> a 'z' quantity for given x,y coordinates.
>
> What are the choices?
>
> Here is a small sample of the data:
>
> The first row has the i-th x-coordinate at which the field starts to have
> the value [i,j].
> The first column has the j-th y-coordinate at which the field starts to
> have the value [i,j].
>
> The coordinate steps are not constant, nor the same for both dimensions;
> they can be anything because they come from some odd finite difference
> program.
>
> My first shot at this is getting combersome, I am hoping for a better way.
>
> So far, because the second decimal place in the x,y coordinate is alwasy
> zero, I simply turned those coordinates into integers by multiplying by ten
> and truncating; then by subtracting the first value from the rest, they
> look
> very much like matrix indeces (except for the missing ones):
>
> Then, because I don't know any better, I broadcast the values onto another
> matrix, to fill in the in-between values:
>
> Now, I have a matrix where every i,j has its own z-value and I am supposed
> to be able to plot it with ax.contourf(mymatrix)...which I can, up until
> about mymatrix[:,:1900] or so, afte that, I get the following error:
>
> Traceback (most recent call last):
> File "C:\findiff\t1.py", line 73, in <module>
> ax.contourf(full[:,:2000])
> File "C:\Python26\lib\site-packages\matplotlib\axes.py", line 7322, in
> contourf
> return mcontour.QuadContourSet(self, *args, **kwargs)
> File "C:\Python26\lib\site-packages\matplotlib\contour.py", line 1106, in
> __init__
> ContourSet.__init__(self, ax, *args, **kwargs)
> File "C:\Python26\lib\site-packages\matplotlib\contour.py", line 700, in
> __init__
> self._process_args(*args, **kwargs)
> File "C:\Python26\lib\site-packages\matplotlib\contour.py", line 1130, in
> _process_args
> C = _cntr.Cntr(x, y, z.filled(), _mask)
> ValueError: Arguments x, y, z, mask (if present) must be 2D arrays.
> x, y, z must be castable to double.
>
>
>
> My current matrix is about 12000x5000.
>
> Any asistance would be greatly appreciated.
>
> Thanks,
>
> Germán
>
>
>
tricontourf() might be more what you are looking for. Another possibility
is pcolor() (note that for irregularly spaced grids, pcolormesh() would not
work).
Cheers!
Ben Root
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users