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

Home » Public Forums » archive » Re: simplest contour & .png
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: simplest contour & .png [message #80004] Thu, 26 April 2012 08:08 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Leslie Moy writes:

> It works if I get rid of '/discrete' to the cgcolorbar command.
> Also, i use 'create_png' not 'output'. My version didn't recognize
> 'output'. Is this a new command? (I haven't updated in a while).

Yes, you must update frequently to stay on top of things. :-)

There are many ways to hear about updates: Twitter, RSS Feeds,
Facebook, and Google +. All will alert you to new features,
articles, and code. The best way to keep current is to use
the SVN repository here:

http://idl-coyote.googlecode.com/svn/

The most current versions are in /trunk/coyote.

> Btw, why is choosing 12 colors significant? (I chose it because that
> was the value you have in your book's example). When would i have to
> use your first suggestion?

It's not significant. It's what I thought you wanted.
Choose any number you like, up to 256.

> My first post! Thank you very very much.

Hooray! ;-)

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.")
Re: simplest contour & .png [message #80007 is a reply to message #80004] Thu, 26 April 2012 07:45 Go to previous messageGo to next message
Leslie Moy is currently offline  Leslie Moy
Messages: 4
Registered: August 2011
Junior Member
On Apr 26, 10:17 am, David Fanning <n...@idlcoyote.com> wrote:
> David Fanning writes:
>> The code you want probably looks more like this:
>
>>    cgLoadCT, 33
>>    cgImage, C, /Scale, /Axes, Position=[0.125,0.125,0.95,0.8], /Window
>>    cgColorbar, Range=[min(C),max(C)],Divisions=12, XTicklen=1, $
>>       XMinor=0,  Position=[0.125,0.915,0.955,0.95],$
>>       Charsize=1.00, Format='(F0.4)', /AddCmd
>>    cgControl, Output='tt.png'
>
> Now that I think about it, if you really just want 12
> colors, the code probably looks more like this:
>
>    cgLoadCT, 33, NColors=12
>    cgImage, BytScl(C, TOP=11), /Axes, Position=[0.125,0.125,0.95,0.8], $
>       /Window
>    cgColorbar, Range=[min(C),max(C)], /Discrete, $
>       Postion=[0.125,0.915,0.955,0.95],$
>       Charsize=1.00, Format='(F0.4)', NColors=12, /AddCmd
>    cgControl, Output='tt.png'
>
> 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.")

It works if I get rid of '/discrete' to the cgcolorbar command.
Also, i use 'create_png' not 'output'. My version didn't recognize
'output'. Is this a new command? (I haven't updated in a while).

Btw, why is choosing 12 colors significant? (I chose it because that
was the value you have in your book's example). When would i have to
use your first suggestion?

My first post! Thank you very very much.

Leslie
Re: simplest contour & .png [message #80008 is a reply to message #80007] Thu, 26 April 2012 07:17 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> The code you want probably looks more like this:
>
> cgLoadCT, 33
> cgImage, C, /Scale, /Axes, Position=[0.125,0.125,0.95,0.8], /Window
> cgColorbar, Range=[min(C),max(C)],Divisions=12, XTicklen=1, $
> XMinor=0, Position=[0.125,0.915,0.955,0.95],$
> Charsize=1.00, Format='(F0.4)', /AddCmd
> cgControl, Output='tt.png'

Now that I think about it, if you really just want 12
colors, the code probably looks more like this:

cgLoadCT, 33, NColors=12
cgImage, BytScl(C, TOP=11), /Axes, Position=[0.125,0.125,0.95,0.8], $
/Window
cgColorbar, Range=[min(C),max(C)], /Discrete, $
Postion=[0.125,0.915,0.955,0.95],$
Charsize=1.00, Format='(F0.4)', NColors=12, /AddCmd
cgControl, Output='tt.png'

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.")
Re: simplest contour & .png [message #80009 is a reply to message #80008] Thu, 26 April 2012 07:12 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Leslie Moy writes:

> It seems like it should be easy...

Oh, it *always* seems so. :-)

> I have a 2D array C(20,20) and i want to make a simple figure with
> 20x20 colored boxes. I started with a CG contour template but have two
> questions.
>
> 1. i assumed there must be a command to Not make it contour and just
> put in a colored box. is there such a thing? or am i starting out
> wrong with 'contour'?

There is such a thing, but it is called an "image".

> 2. i want to output to a .png file. but i get two figures with my code
> below - one of the contour plot, the other of the colorbar. normally i
> would think to add in /overplot to cgcolorbar but that gives me an
> error.

The keyword you are looking for is AddCmd, not Overplot. You want to
"add" the "command" to the resizeable cgWindow.

>
> cgwindow
> nlevels=12
> loadct,33,ncolors=nlevels,bottom=1
> step=(max(C)-min(C))/nlevels
> levels=indgen(nlevels)*step+min(C)
> setdecomposedstate,0,currentstate=currentstate

No reason whatsoever to set yourself up in indexed color
mode if you are using Coyote Graphics routines. They
will work best in decomposed color mode and, in fact, most
of them work in that mode anyway. Including the cgContour
command. So this SetDecomposedState command has NO effect
whatsoever.

>
> cgcontour,C,/fill,Levels=levels,position=[0.125,0.125,0.95,0 .8],$
> background=cgcolor('white'),color=cgcolor('black'),$
> xstyle=1,ystyle=1,c_colors=indgen(nlevels)+1,/window
>
> setdecomposedstate,currentstate
> cgcolorbar,range=[min(C),max(C)],divisions=12,xticklen=1,xmi nor=0,$
> annotatecolor='black',ncolors=12,bottom=1, $
>
> position=[0.125,0.915,0.955,0.95],charsize=1.00,format='(F0. 4)'
>
> cgcontrol,create_png='tt.png'

The code you want probably looks more like this:

cgLoadCT, 33
cgImage, C, /Scale, /Axes, Position=[0.125,0.125,0.95,0.8], /Window
cgColorbar, Range=[min(C),max(C)],Divisions=12, XTicklen=1, $
XMinor=0, Position=[0.125,0.915,0.955,0.95],$
Charsize=1.00, Format='(F0.4)', /AddCmd
cgControl, Output='tt.png'

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.")
Re: simplest contour & .png [message #80134 is a reply to message #80004] Mon, 30 April 2012 07:49 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
On 04/26/12 11:08, David Fanning wrote:
> Leslie Moy writes:
>
>> It works if I get rid of '/discrete' to the cgcolorbar command.
>> Also, i use 'create_png' not 'output'. My version didn't recognize
>> 'output'. Is this a new command? (I haven't updated in a while).
>
> Yes, you must update frequently to stay on top of things. :-)
>
> There are many ways to hear about updates: Twitter, RSS Feeds,
> Facebook, and Google +. All will alert you to new features,
> articles, and code. The best way to keep current is to use
> the SVN repository here:
>
> http://idl-coyote.googlecode.com/svn/

Does the "coyote_library_1.12.5" tag include these latest updates?

I.e. from:
http://idl-coyote.googlecode.com/svn/tags/coyote/coyote_libr ary_1.12.5

?

The google-code repo browser is pretty brain dead regarding timeline browsing and the "committed changes" list doesn't
have any entries for tag creation.

Your library is part of our repository as well and, as such, I'd rather provide a tagged version than one from trunk.
The last tagged version mentioned on your project page is v1.11.0 (from 03 March)

cheers,

paulv

p.s. I really like the "Issues" page on your google code site. Of the idl-coyote project it states: "This project
currently has no issues." Man... I lay awake at night dreaming about reaching that stage with my software projects.

:oD


>
> The most current versions are in /trunk/coyote.
>
>> Btw, why is choosing 12 colors significant? (I chose it because that
>> was the value you have in your book's example). When would i have to
>> use your first suggestion?
>
> It's not significant. It's what I thought you wanted.
> Choose any number you like, up to 256.
>
>> My first post! Thank you very very much.
>
> Hooray! ;-)
>
> Cheers,
>
> David
>
>
Re: simplest contour & .png [message #84668 is a reply to message #80008] Thu, 26 April 2012 07:44 Go to previous message
Leslie Moy is currently offline  Leslie Moy
Messages: 4
Registered: August 2011
Junior Member
On Apr 26, 10:17 am, David Fanning <n...@idlcoyote.com> wrote:
> David Fanning writes:
>> The code you want probably looks more like this:
>
>>    cgLoadCT, 33
>>    cgImage, C, /Scale, /Axes, Position=[0.125,0.125,0.95,0.8], /Window
>>    cgColorbar, Range=[min(C),max(C)],Divisions=12, XTicklen=1, $
>>       XMinor=0,  Position=[0.125,0.915,0.955,0.95],$
>>       Charsize=1.00, Format='(F0.4)', /AddCmd
>>    cgControl, Output='tt.png'
>
> Now that I think about it, if you really just want 12
> colors, the code probably looks more like this:
>
>    cgLoadCT, 33, NColors=12
>    cgImage, BytScl(C, TOP=11), /Axes, Position=[0.125,0.125,0.95,0.8], $
>       /Window
>    cgColorbar, Range=[min(C),max(C)], /Discrete, $
>       Postion=[0.125,0.915,0.955,0.95],$
>       Charsize=1.00, Format='(F0.4)', NColors=12, /AddCmd
>    cgControl, Output='tt.png'
>
> 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.")

It works if I get rid of '/discrete' to the cgcolorbar command.
Also, i use 'create_png' not 'output'. My version didn't recognize
'output'. Is this a new command? (I haven't updated in a while).

Btw, why is choosing 12 colors significant? (I chose it because that
was the value you have in your book's example). When would i have to
use your first suggestion?

My first post! Thank you very very much.

Leslie
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to make an input parameters file??
Next Topic: IDL v7.0 "native" colourbar procedure?

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

Current Time: Wed Oct 08 11:50:59 PDT 2025

Total time taken to generate the page: 0.00646 seconds