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

Home » Public Forums » archive » Re: tv with axes routine
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: tv with axes routine [message #51606] Mon, 04 December 2006 07:40
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
spectro_plot is a good routine but seems to have a touch of odd
behavior (I didn't know about this routine before)

odd behavior:
;; setup some data
dat = dist(100)
;; x is just 1:100
x = findgen(100)
y = findgen(100)
;; y has a datagap at 49 by 100
y[50:*] += 100
spectro_plot, dat, x, y, /no_ut
END

I would expect the plot to have a 100 unit gap in y but instead I get
oddness.

Have a look,

Cheers,

Brian



Paolo Grigis wrote:
> The solution proposed are useful, but actually sometimes you want
> a behaviour similar to contour even for *not-uniformely* spaced
> data, such that you specify an image z and two axis vectors
> x and y with the coordinates of each horizontal and vertical
> channel. In solarsoft, the routine "spectro_plot" will do that
> for you.
>
> Example:
>
> ;create some data
> nx=800
> ny=600
>
> ;image
> im=dist(nx,ny)
>
> ;log scaled axis
> x=10.^(findgen(nx)/(nx-1)*2)
> y=10.^(findgen(ny)/(ny-1)*2+1)
>
> ;pick color table
> loadct,5
>
> ;linear color scale
> spectro_plot,im,x,y,/xlog,/ylog,/xstyle,/ystyle,/no_ut
>
> ;logarithmic color scale
> spectro_plot,im,x,y,/xlog,/ylog,/zlog,/xstyle,/ystyle,/no_ut
>
> ;linear axis & color
> spectro_plot,im,x,y,/xstyle,/ystyle,/no_ut
>
> Ciao,
> Paolo
>
>
Re: tv with axes routine [message #51608 is a reply to message #51606] Mon, 04 December 2006 01:21 Go to previous message
Paolo Grigis is currently offline  Paolo Grigis
Messages: 171
Registered: December 2003
Senior Member
The solution proposed are useful, but actually sometimes you want
a behaviour similar to contour even for *not-uniformely* spaced
data, such that you specify an image z and two axis vectors
x and y with the coordinates of each horizontal and vertical
channel. In solarsoft, the routine "spectro_plot" will do that
for you.

Example:

;create some data
nx=800
ny=600

;image
im=dist(nx,ny)

;log scaled axis
x=10.^(findgen(nx)/(nx-1)*2)
y=10.^(findgen(ny)/(ny-1)*2+1)

;pick color table
loadct,5

;linear color scale
spectro_plot,im,x,y,/xlog,/ylog,/xstyle,/ystyle,/no_ut

;logarithmic color scale
spectro_plot,im,x,y,/xlog,/ylog,/zlog,/xstyle,/ystyle,/no_ut

;linear axis & color
spectro_plot,im,x,y,/xstyle,/ystyle,/no_ut

Ciao,
Paolo

Brian Larsen wrote:
> Has anyone out there written a wrapper for tv that makes the output
> look like contour?
>
> By like contour I mean with axes, and in the center of the window,
> scalable zrange, log scales, ability to add a colorbar (using colorbar
> would work separately also so long as position works)
> Contour is great but it inherently smooths and takes forever, I don't
> want either.
>
> This would be a blocky version of
> IDL> contour, dist(100), /fill, nlevels=100
>
> but of course
> IDL> tvscl, dist(100)
> doesn't have any axes, is in the wrong place and all.
>
> This would be the equivalent then of imagesc() in matlab.
>
> Cheers,
>
> -Brian
>
Re: tv with axes routine [message #51609 is a reply to message #51608] Sat, 02 December 2006 18:54 Go to previous message
mmeron is currently offline  mmeron
Messages: 44
Registered: October 2003
Member
In article <1165110404.479762.213230@73g2000cwn.googlegroups.com>, "Brian Larsen" <balarsen@gmail.com> writes:
> Mati,
>
> thanks much, this routine is great. Just what I would have tried to
> write.
>
> Thanks again,
>
You're very welcome. I'm glad to see it being useful.

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
Re: tv with axes routine [message #51610 is a reply to message #51609] Sat, 02 December 2006 17:46 Go to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
Mati,

thanks much, this routine is great. Just what I would have tried to
write.

Thanks again,

Brian
Re: tv with axes routine [message #51612 is a reply to message #51610] Sat, 02 December 2006 17:28 Go to previous message
mmeron is currently offline  mmeron
Messages: 44
Registered: October 2003
Member
In article <1165104217.422708.91740@n67g2000cwd.googlegroups.com>, "Brian Larsen" <balarsen@gmail.com> writes:
> I tried to send you this with this result, so I will just post here
> ----- The following addresses had permanent fatal errors -----
> <m...@cars3.uchicago.edu> (I added the ...)
> (reason: 550 5.7.1 Unable to relay for m...@cars3.uchicago.edu)
>
Oh, that's a dead mailbox, the proper address is in the sig. But no
matter, got your address, I'll zip the library and email it to you.

>
> ------------
>
> I would love to have the newer version, this could save a bunch
> of time
> of me reinventing a perfectly good wheel.
>
> If you wouldn't mind and its small enough for email
> balarsen@gmail.com
> is as good as any address.
>
> Thanks much,
>
> Brian
>
>
>
>> My Display_mm will do these things. Unfortunately, even though I
>> forwarded ti RSI (sorry, ITT) an updated version of my library (called
>> MIDL_LIB) few months ago, their user contributions page still provides
>> only the older version of the library, from 2002 (which lacks
>> Display_mm). If you want a newer version you'll have to contact me.
>>
>> Mati Meron | "When you argue with a fool,
>> meron@cars.uchicago.edu | chances are he is doing just the same"
>

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
Re: tv with axes routine [message #51613 is a reply to message #51612] Sat, 02 December 2006 16:03 Go to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
I tried to send you this with this result, so I will just post here
----- The following addresses had permanent fatal errors -----
<m...@cars3.uchicago.edu> (I added the ...)
(reason: 550 5.7.1 Unable to relay for m...@cars3.uchicago.edu)


------------

I would love to have the newer version, this could save a bunch
of time
of me reinventing a perfectly good wheel.

If you wouldn't mind and its small enough for email
balarsen@gmail.com
is as good as any address.

Thanks much,

Brian



> My Display_mm will do these things. Unfortunately, even though I
> forwarded ti RSI (sorry, ITT) an updated version of my library (called
> MIDL_LIB) few months ago, their user contributions page still provides
> only the older version of the library, from 2002 (which lacks
> Display_mm). If you want a newer version you'll have to contact me.
>
> Mati Meron | "When you argue with a fool,
> meron@cars.uchicago.edu | chances are he is doing just the same"
Re: tv with axes routine [message #51614 is a reply to message #51613] Sat, 02 December 2006 15:53 Go to previous message
mmeron is currently offline  mmeron
Messages: 44
Registered: October 2003
Member
In article <1165095337.186137.225850@n67g2000cwd.googlegroups.com>, "Brian Larsen" <balarsen@gmail.com> writes:
> Has anyone out there written a wrapper for tv that makes the output
> look like contour?
>
> By like contour I mean with axes, and in the center of the window,
> scalable zrange, log scales, ability to add a colorbar (using colorbar
> would work separately also so long as position works)
> Contour is great but it inherently smooths and takes forever, I don't
> want either.
>
> This would be a blocky version of
> IDL> contour, dist(100), /fill, nlevels=100
>
> but of course
> IDL> tvscl, dist(100)
> doesn't have any axes, is in the wrong place and all.
>
> This would be the equivalent then of imagesc() in matlab.
>
> Cheers,
>
My Display_mm will do these things. Unfortunately, even though I
forwarded ti RSI (sorry, ITT) an updated version of my library (called
MIDL_LIB) few months ago, their user contributions page still provides
only the older version of the library, from 2002 (which lacks
Display_mm). If you want a newer version you'll have to contact me.

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
Re: tv with axes routine [message #51616 is a reply to message #51614] Sat, 02 December 2006 14:33 Go to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
Oops, this being TVIMAGE


Brian Larsen wrote:
> OK,
> fixed there was an ancient version of this hiding on my system that was
> ahead of the version from solarsoft (same version as from your site) in
> my path. Getting rid of the ancient version makes it work.
>
> Thanks much this will greatly speed things up I hope,
>
> Brian
Re: tv with axes routine [message #51617 is a reply to message #51616] Sat, 02 December 2006 14:30 Go to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
OK,
fixed there was an ancient version of this hiding on my system that was
ahead of the version from solarsoft (same version as from your site) in
my path. Getting rid of the ancient version makes it work.

Thanks much this will greatly speed things up I hope,

Brian
Re: tv with axes routine [message #51618 is a reply to message #51617] Sat, 02 December 2006 14:27 Go to previous message
Brian Larsen is currently offline  Brian Larsen
Messages: 270
Registered: June 2006
Senior Member
Odd enough this doesn't work the first time I call it. I get
non-square axes and a colorbar but nothing in it.

Then I can it again and I get the right thing splattered overtop the
wrong thing...



-Brian
Re: tv with axes routine [message #51619 is a reply to message #51618] Sat, 02 December 2006 14:08 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Brian Larsen writes:

> Has anyone out there written a wrapper for tv that makes the output
> look like contour?
>
> By like contour I mean with axes, and in the center of the window,
> scalable zrange, log scales, ability to add a colorbar (using colorbar
> would work separately also so long as position works)
> Contour is great but it inherently smooths and takes forever, I don't
> want either.
>
> This would be a blocky version of
> IDL> contour, dist(100), /fill, nlevels=100
>
> but of course
> IDL> tvscl, dist(100)
> doesn't have any axes, is in the wrong place and all.
>
> This would be the equivalent then of imagesc() in matlab.

xrange = [-5, 5]
yrange = [5, 15]
image = Dist(256)
LoadCT, 33, NColors=100, Bottom=1, /Silent
position = [0.1, 0.1, 0.9, 0.75]
TVImage, BytScl(image, Top=99), Position=position, $
/Keep_Aspect, /Erase, /NoInterpolate
Plot, xrange, yrange, XRANGE=xrange, YRANGE=yrange, $
Position=position, XStyle=1, YStyle=1, /NoData, /NoErase
Colorbar, Range=[Min(image), Max(image)], Divisions=10, $
Minor=5, NColors=100, Bottom=1, $
Position=[position[0], 0.88, position[2], 0.95]

You could easily slap this into a wrapper procedure if you
like. Call it IMAGESC. :-)

You can find the relevant programs in the Coyote Library.

http://www.dfanning.com/documents/programs.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: objects, crashes, and negative memory oh my
Next Topic: Can I Pass an object to IDL_IDLBridge session?

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

Current Time: Wed Oct 08 14:00:46 PDT 2025

Total time taken to generate the page: 0.00653 seconds