comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Variable Pixel Spacing for Images in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Variable Pixel Spacing for Images in IDL [message #86717 is a reply to message #86711] Fri, 29 November 2013 08:34 Go to previous messageGo to previous message
robseigel is currently offline  robseigel
Messages: 3
Registered: November 2013
Junior Member
On Friday, November 29, 2013 8:54:51 AM UTC-5, Robert Seigel wrote:
> 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

Thank you for the replies.

Alx,

As I have tried in the past, I am unable to use two-dimensional arrays for X and Y in the IMAGE function. Using your [Alex] example:

IDL> p = image(rgbData,rebin(xaxis,xcount,zcount),rebin(reform(yaxis, 1,zcount),xcount,zcount),/buffer, $
IDL> axis_style=2)
% IMAGE: X must be a vector.

I am not sure why IMAGE does not accept X and Y as 2d arrays. However, your second suggestion worked well with one slight modification to the interpolate call [indgen(xcount) rather than xaxis]:

regYaxis = (zcoords[-1] - zcoords[0])*findgen(zcount)/(zcount -1)
data = interpolate(data, indgen(xcount), interpol(findgen(zcount), zcoords, regYaxis), /GRID)

But, I cannot interpolate these data because they are flags and interpolation between them results in incorrect classification at many locations. The values in the array are one of [-4,-3,-2,-1,0,1,2,3,4], so e.g. when a 4 is next to a 0 the interpolation often creates a false classification.

David,

This routine is exactly what I was looking for!

Cheers,
Rob
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Barplot using Coyote, the colors keep changing, why?
Next Topic: Log system ??

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:34:40 PDT 2025

Total time taken to generate the page: 0.00367 seconds