Re: IDLgrImage image plot problem [message #50297] |
Tue, 26 September 2006 14:11  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
yy writes:
> I want to plot a 2D data set by using object graphics.
> And I want it to be colored. If I use direct graphics plot,
> it can be done as the following:
> WINDOW, 0, XSIZE=300, YSIZE=300
> LOADCT,13
> IMAGE_AX, 2ddata
>
> However, when I try to use IDLgrImage, nothing appears
> on screen. I don't know if it's because I didn't position the
> image correctly. But if it is, I still don't know how to find the
> image. Below is what I did:
> oWindow = OBJ_NEW('IDLgrWindow', DIMENSIONS=[300,300])
> oView = OBJ_NEW('IDLgrView')
> oModel = OBJ_NEW('IDLgrModel')
>
> ; Load color table 13
> oPalette = OBJ_NEW('IDLgrPalette')
> oPalette -> LoadCT, 13
> oImage = OBJ_NEW('IDLgrImage', 2ddata, PALETTE = oPalette)
>
> oModel -> Add, oImage
> oView -> Add, oModel
> oWindow -> Draw, oView
Well, I think what you put in the window is the lower-left
pixel of your image. Don't worry, in my experience about
85% of the people who start using object graphics in IDL
do this. I certainly did. :-)
You are going to have to decide what kind of coordinate
system you are going to use in your view object. It
might make a LOT more sense to use a coordinate system
more in line with your image dimensions that with the
default coordinate system that will show a single pixel.
Check your viewplance rectangle. And you might have a look
at ximage.pro in the Coyote directory for an alternate way
to get to the same place:
http://www.dfanning.com/programs/ximage.pro
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|