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

Home » Public Forums » archive » Re: cgPlotS and cgColorBar issues
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: cgPlotS and cgColorBar issues [message #83582] Tue, 19 March 2013 12:12
allisonjaynes is currently offline  allisonjaynes
Messages: 26
Registered: May 2012
Junior Member
Of course! I kept thinking 'Format' was referencing the first suggestion of 'Ytickformat'.

Thanks for the patience.
Re: cgPlotS and cgColorBar issues [message #83594 is a reply to message #83582] Mon, 18 March 2013 17:54 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
allison jaynes writes:

> But add the FORMAT to those Y values and suddenly the tick labels show up on both the right and left of the vertical color bar! (Regardless of using the /right keyword or not):
>
> IDL> cgColorBar, range=[1,300], /Vertical, YTICKFORMAT='(F4.0)', /Window
>
> What am I doing wrong?

Yes, when I type *this* command I see labels on both sides of the bar.

But, if I type the command correctly:

IDL> cgColorBar, range=[1,300], /Vertical, FORMAT='(F4.0)', /Window

It works correctly.

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.")
Re: cgPlotS and cgColorBar issues [message #83595 is a reply to message #83594] Mon, 18 March 2013 16:44 Go to previous message
allisonjaynes is currently offline  allisonjaynes
Messages: 26
Registered: May 2012
Junior Member
Yep! Up-to-date. And just to be sure, I replaced my cgcolorbar with that one. Anybody able to reproduce the tick labels on both sides of the bar?
Re: cgPlotS and cgColorBar issues [message #83598 is a reply to message #83595] Mon, 18 March 2013 10:43 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
allison jaynes writes:

> Ok, here are a few examples of what is going on.
>
> The FORMAT works as expected with a horizontal color bar:
>
> IDL> cgColorBar, range=[1,300], XTICKFORMAT='(F4.0)', /Window
>
>
> And the vertical color bar without FORMAT also looks as you'd want:
>
> IDL> cgColorBar, range=[1,300], /Vertical, /Window
>
>
> But add the FORMAT to those Y values and suddenly the tick labels show up on both the right and left of the vertical color bar! (Regardless of using the /right keyword or not):
>
> IDL> cgColorBar, range=[1,300], /Vertical, YTICKFORMAT='(F4.0)', /Window
>
> What am I doing wrong?

Humm. Can't check right this minute, but are you using the LATEST
colorbar routine:

http://www.idlcoyote.com/programs/cgcolorbar.pro

It is important that your Coyote Library is up to date.

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.")
Re: cgPlotS and cgColorBar issues [message #83601 is a reply to message #83598] Mon, 18 March 2013 07:03 Go to previous message
allisonjaynes is currently offline  allisonjaynes
Messages: 26
Registered: May 2012
Junior Member
Ok, here are a few examples of what is going on.

The FORMAT works as expected with a horizontal color bar:

IDL> cgColorBar, range=[1,300], XTICKFORMAT='(F4.0)', /Window


And the vertical color bar without FORMAT also looks as you'd want:

IDL> cgColorBar, range=[1,300], /Vertical, /Window


But add the FORMAT to those Y values and suddenly the tick labels show up on both the right and left of the vertical color bar! (Regardless of using the /right keyword or not):

IDL> cgColorBar, range=[1,300], /Vertical, YTICKFORMAT='(F4.0)', /Window

What am I doing wrong?
Re: cgPlotS and cgColorBar issues [message #83603 is a reply to message #83601] Mon, 18 March 2013 05:58 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
allison jaynes writes:

> I thought that YTICKFORMAT should work, but it gives a funny display (labels on both sides of the color bar) so I had considered that it wasn't a compatible keyword with cgColorbar. I'm running 8.2 on a Mac. Does that keyword typically work?

Perhaps I've broken the expectation paradiem here, but the FORMAT
keyword should work. I've done this so I have one keyword that works
with either vertical or horizontal color bars. :-)

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.")
Re: cgPlotS and cgColorBar issues [message #83611 is a reply to message #83603] Sun, 17 March 2013 20:10 Go to previous message
allisonjaynes is currently offline  allisonjaynes
Messages: 26
Registered: May 2012
Junior Member
I thought that YTICKFORMAT should work, but it gives a funny display (labels on both sides of the color bar) so I had considered that it wasn't a compatible keyword with cgColorbar. I'm running 8.2 on a Mac. Does that keyword typically work?

And the cgControl, execute... worked wonderfully. Thank you!
Re: cgPlotS and cgColorBar issues [message #83619 is a reply to message #83611] Fri, 15 March 2013 15:17 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On 3/15/13 3:58 PM, allison jaynes wrote:
> Hi everyone,
> Forgive me if these questions have already been answered.
>
> Let me start with cgPlotS. I am using it to plot 2 color-scaled data curves on top of each other, so I have 2 calls to it in a row, one for each data set. For example,
> cgPlot, [xrange], [yrange], /NODATA, /Window
> if sat NE 'b' then cgPlotS, JDa, La, color=BSCLa, /AddCMD
> if sat NE 'a' then cgPlotS, JDb, Lb, color=BSCLb, /AddCMD
>
> When I have the condition where I want to plot both sets, I can watch cgPlotS plotting data set A in a resizeable graphics window. But when it moves on to the second call, it erases what it just plotted and then re-draws the A data set before drawing the B data set on top of it. The end result is correct (2 curves overplotted), but the drawing of the A data set twice is undesirable. For large data intervals, the plotting time ends up being on the order of minutes and the time sink for re-plotting A is driving me nuts. Any idea what causes/fixes this?
>
>
>
> The second issue concerns cgColorBar. Below is my call:
>
> for z=0, fix(scaleZ) do ticklog=[ticklog, 10L^z]
>
> cgColorBar, /YLOG, /Vertical, Position=[0.94, 0.05, 0.96, 0.95], title='Electron Flux (cm!e2!n s sr MeV)!e-1!n', YTICKV=ticklog, color='white', /right, range=[1,10L^z], /AddCMD
>
> The idea is to have a vertical, log-scaled color bar with divisions of powers of ten. Here is the weird part. Sometimes when I plot this the color bar labels look like so: [1, 10, 10^2, 10^3, 10^4....], where the carrot-raised number actually appears as an exponential. Other times (without changing the code whatsoever) the labels come out like this: [1, 10, 100, 1000, 10000....]. The parameter that determines the display format is the limit of the range - if it goes up to 10^5 or higher, everything stays in exponential format. If the maximum range is 10^4 or lower, it displays in regular format. Suggestions on how to force the exponential display?
>
> Thank you for any guidance!
>
>
> -Allison
>

To disable updating while you put several data sets on the plot,
temporarily turn updating of the cgwindow off:

cgcontrol, execute=0
...do all of your cgplots commands...
cgcontrol, execute=1

-Jeremy.
Re: cgPlotS and cgColorBar issues [message #83620 is a reply to message #83619] Fri, 15 March 2013 14:54 Go to previous message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
> re-plotting A is driving me nuts. Any idea what causes/fixes this?

In order to be able to resize the plots in the window, the position of each plot has to be recalculated and then each plot has to be re-displayed to the correct size. So, A will be replotted after each re-size.

Anything with /addCMD probably falls into this re-plotting loop.
Re: cgPlotS and cgColorBar issues [message #83621 is a reply to message #83620] Fri, 15 March 2013 14:41 Go to previous message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
> Suggestions on how to force the exponential display?

You can write a function to format your axis labels and then call it with the [xy]tickformat keywords.
Re: cgPlotS and cgColorBar issues [message #83625 is a reply to message #83621] Fri, 15 March 2013 14:01 Go to previous message
allisonjaynes is currently offline  allisonjaynes
Messages: 26
Registered: May 2012
Junior Member
I should note that, for the cgPlotS problem, it does NOT draw A twice over in the normal IDL display (take out all the /Window and /AddCMDs). There, it plots A once and then B over top, as one would expect.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: HASH makes too many temporaries
Next Topic: ENVI 5.0 reading MODIS rapidfire images? JPEG/WORLD FILE

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

Current Time: Wed Oct 08 13:39:22 PDT 2025

Total time taken to generate the page: 0.00495 seconds