Re: cgHistoPlot - locations and histdata keywords? [message #79630] |
Fri, 16 March 2012 14:45  |
BLesht
Messages: 89 Registered: March 2007
|
Member |
|
|
On Friday, March 16, 2012 3:43:49 PM UTC-5, David Fanning wrote:
> Barry Lesht writes:
>
>> Hi - I'm having problems using cgHistoPlot in a re-sizable graphics window.
>>
>> For example,
>>
>> cgWindow, xwsize=xSize, ywsize=ySize
>> cgWindow, 'cgHistoPlot', data, binsize=1., LOCATIONS=locs, HISTDATA=hists, /LoadCmd
>> HELP, locs, hists
>> cgWindow, /ExecuteCmd
>>
>> Yields,
>> LOCS UNDEFINED = <Undefined>
>> HISTS UNDEFINED = <Undefined>
>>
>> There is an old post referring to what looks like a similar problem; is there a simple way around it?
>
> The simple way to work around it, of course, is to first
> do the command in a regular display window, where there
> is no issue in returning keywords. I would use a pixmap
> window, probably, if I didn't want anyone to see it:
>
> IDL> data = cgDemoData(7)
> IDL> cgDisplay, /Pixmap, /Free
> IDL> cgHistoPlot, data, binsize=1., LOCATIONS=locs, HISTDATA=hists
> IDL> WDelete, !D.Window
> IDL> Help, locs, hists
> LOCS INT = Array[256]
> HISTS LONG = Array[256]
>
> Then you can proceed normally with the values you need.
>
> Cheers,
>
> David
>
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thue. ("Perhaps thos speakest truth.")
Hi David,
OK, I think I get it. Essentially I do it twice; the second time I can use the values returned by the first call to cgHistoPlot to do what I want, which is to annotate the histogram created by cgHistoPlot with the number of elements in each bin. Since I'm not using passed keywords in the second call, I can put it into a cgWindow, and then use cgText to do the annotation.
Thanks, Barry
|
|
|