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

Home » Public Forums » archive » Current color table
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
Current color table [message #91486] Mon, 20 July 2015 09:59 Go to next message
a146397258 is currently offline  a146397258
Messages: 7
Registered: July 2015
Junior Member
When the user clicks a button, the program executes xloadct, allowing them to then select and/or modify a color table. I would like to have a small piece of text below the button that indicates the currently loaded color table. Where would the current color table index and its name be stored? I can't find it anywhere. I also need the table number to preserve the current color table, as the script executes a color plot, and then a different plot which must be black and white. In between runs I don't want the user to have to reselect the color table, but unfortunately it is reverted to black and white to properly generate the second plot. There's probably something simple I am missing...
Re: Current color table [message #91500 is a reply to message #91486] Tue, 21 July 2015 09:30 Go to previous messageGo to next message
a146397258 is currently offline  a146397258
Messages: 7
Registered: July 2015
Junior Member
Fixed the second problem by working with TVLCT to save temp values. I am still looking for a way to get the current table name, so I can display this to the user though. Any help would be appreciated.
Re: Current color table [message #91525 is a reply to message #91486] Thu, 23 July 2015 15:03 Go to previous messageGo to next message
jimuba is currently offline  jimuba
Messages: 9
Registered: February 2009
Junior Member
On Monday, July 20, 2015 at 10:59:28 AM UTC-6, a1463...@gmail.com wrote:
> When the user clicks a button, the program executes xloadct, allowing them to then select and/or modify a color table. I would like to have a small piece of text below the button that indicates the currently loaded color table. Where would the current color table index and its name be stored? I can't find it anywhere. I also need the table number to preserve the current color table, as the script executes a color plot, and then a different plot which must be black and white. In between runs I don't want the user to have to reselect the color table, but unfortunately it is reverted to black and white to properly generate the second plot. There's probably something simple I am missing...

Hi, would an approach like the following work for you?

xloadct, /block
tvlct, r, g, b, /get
loadct, get_names=ctnames
tvlct, r, g, b, /get
ct = [[r],[g],[b]]

for i=0, n_elements(ctnames)-1 do $
if array_equal(ct, colortable(i)) then begin
print,strtrim(i,1),' : ',ctnames[i]
break
endif

end
Re: Current color table [message #91528 is a reply to message #91525] Fri, 24 July 2015 07:15 Go to previous messageGo to next message
a146397258 is currently offline  a146397258
Messages: 7
Registered: July 2015
Junior Member
On Thursday, July 23, 2015 at 4:03:37 PM UTC-6, jim...@gmail.com wrote:
> On Monday, July 20, 2015 at 10:59:28 AM UTC-6, a1463...@gmail.com wrote:
>> When the user clicks a button, the program executes xloadct, allowing them to then select and/or modify a color table. I would like to have a small piece of text below the button that indicates the currently loaded color table. Where would the current color table index and its name be stored? I can't find it anywhere. I also need the table number to preserve the current color table, as the script executes a color plot, and then a different plot which must be black and white. In between runs I don't want the user to have to reselect the color table, but unfortunately it is reverted to black and white to properly generate the second plot. There's probably something simple I am missing...
>
> Hi, would an approach like the following work for you?
>
> xloadct, /block
> tvlct, r, g, b, /get
> loadct, get_names=ctnames
> tvlct, r, g, b, /get
> ct = [[r],[g],[b]]
>
> for i=0, n_elements(ctnames)-1 do $
> if array_equal(ct, colortable(i)) then begin
> print,strtrim(i,1),' : ',ctnames[i]
> break
> endif
>
> end

Wow, fantastic. Thank you very much.
Re: Current color table [message #91541 is a reply to message #91486] Sun, 26 July 2015 12:19 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
a146397258@gmail.com writes:

> When the user clicks a button, the program executes xloadct, allowing them to then select and/or modify a color table. I would like to have a small piece of text below the button that indicates the currently loaded color table. Where would the current color table index and its name be stored? I can't find it anywhere. I also need the table number to preserve the current color table, as the script executes a color plot, and then a different plot which must be black and
white. In between runs I don't want the user to have to reselect the color table, but unfortunately it is reverted to black and white to properly generate the second plot. There's probably something simple I am missing...

Yes, cgLoadCT.

http://www.idlcoyote.com/idldoc/cg/cgloadct.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: External development: Populating a complex array in C
Next Topic: HELP adding arrays

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

Current Time: Wed Oct 08 07:14:51 PDT 2025

Total time taken to generate the page: 0.00613 seconds