Current color table [message #91486] |
Mon, 20 July 2015 09:59  |
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 #91525 is a reply to message #91486] |
Thu, 23 July 2015 15:03   |
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   |
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  |
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.")
|
|
|