Le vendredi 29 novembre 2013 14:54:51 UTC+1, Robert Seigel a écrit :
> Hello,
>
>
>
> I have a 2D array that is an x-z vertical plane, where the vertical axis is stretched from ~ 25 meter spacing between rows at the bottom (index = 0) to 100 meter spacing at the top. I am trying to plot these data as an image with the y-axis "stretched" appropriately:
>
>
>
> yaxis = zcoords ; Vertical axis [12.4,37.67,63.44...16400,16500,16600]
>
> xaxis = xcoords ; Horizontal axis [0,100,200...50900,51000,51100]
>
> p = image(rgbData,xaxis,yaxis,/buffer, $
>
> axis_style=2)
>
>
>
> But, the above code does stretch the image properly. Using contour stretches the data fine, but I would prefer to plot these data as an image. Does anyone know how I can plot these data as an image so that the data points match the locations specified by yaxis?
>
>
>
> Thanks,
>
> Rob
rgbData is a 2D array, xaxis and yaxis are 1D vectors.
if you can use IDL 8.2.3, following the IMAGE documentation:
"If Data, X, and Y are two-dimensional arrays with the same number of elements, then the X and Y coordinates will be tested to determine if the points are regularly or irregularly spaced. [...], if the data are irregularly spaced, then IDL will automatically grid the data so that the points lie on a regular grid".
Then you should succeed with:
p = image(rgbdata, rebin(xaxis,nx,ny), rebin(reform(yaxis,1,ny),nx,ny), ...)
if you cannot, you have to do interpolation by yourself. For instance:
regYaxis = (yaxis[-1] - yaxis[0])*findgen(ny)/(ny -1)
regData = interpolate(rgbData, xaxis, interpol(findgen(ny), yaxis, regYaxis), /GRID)
p = image(regData, xaxis, regYaxis, ...)
alx.
|