| Re: More Function Graphics Confusion [message #77657 is a reply to message #77570] |
Tue, 13 September 2011 15:34  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> If you comment these three lines out, and uncomment line 26, which
> uses a fake image plot, rather than a fake contour plot, for this
> purpose, the color bar just doesn't show up at all!
>
> Can anyone think of a reason for this?
>
> It appears the fakeContourPlot.Delete line is the culprit.
> When I use the contour plot, this line deletes only the contour
> plot, but the color bar stays. When I use the image plot, this line
> deletes BOTH the image and the color bar. Is this another feature
> I should be aware of?
This turns out to be the case because when you delete
a contour plot object, it leaves a set of axes behind,
thus there is "something" there to which the colorbar
can be attached, so it stays.
When you delete an image, the image is gone, nothing
stays behind, so the color bar attached to that image
is also destroyed.
At least I *think* this is the explanation. I've
pretty much given up looking for rationality and
am willing to believe almost anything at the moment. :-(
Here is a program to play with, if you are interested.
Switch the "anImageObj" lines to see what happens with
a contour plot.
loadct, 33
TVLCT, rgb, /Get
thisImage = cgDemoData(7)
w = Window(DIMENSIONS=[500, 350])
anImageObj = Image(thisImage, RGB_TABLE=rgb, /CURRENT)
;anImageObj = Contour(thisImage, RGB_TABLE=rgb, /CURRENT)
cb = Colorbar(TARGET=anImageObj , $
POSITION=[0.1, 0.90, 0.9, 0.95], MAJOR=5)
anImageObj.Delete
END
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|