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

Home » Public Forums » archive » How to create a colour table in IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to create a colour table in IDL? [message #90027 is a reply to message #90022] Thu, 15 January 2015 09:28 Go to previous messageGo to previous message
atmospheric physics is currently offline  atmospheric physics
Messages: 121
Registered: June 2010
Senior Member
Hello David & Jeff,

Thanks for the advice. While I could get the plot as desired, I still find the axis, ticks and labels in 'red' colour (for both the colorbar and plot).

Am I missing something? How can I change the color of axis, ticks and labels to default 'black' color?

------------------------
PRO testplot

tindex = indgen(1000)
d = randomu(1L, 12, 1000)
minval = MIN(d,MAX=maxval)

FigFile = 'testplot1.ps'

cgPS_Open, FigFile
cgDisplay
thick = (!D.Name EQ 'PS') ? 2:1

!P.Multi=0

device, decomposed=0
cgLoadCT, 0
cgLoadCT, 22, /Brewer, ncolors=6

mg_horizon, tindex, d, nbands=6,titles=ytitles, $
xstyle=1, ystyle=1, Xrange=[0,1000], $
Thick=thick, Font=-1, minimum=minval, $
maximum=maxval, Position=[0.1,0.3,0.70,0.94], $
colors=[0, 1, 2, 3, 4, 5]

cgColorbar, ncolors=6, divisions=6, TCharsize=0.12, $
range=[minval,maxval],/right, tlocation='right', $
Title='d',/Vertical, Font=-1, Minor=5, $
Position=[0.81,0.32,0.83,0.90]

; Closing the figure file
cgPS_Close
; Create a PNG file
cgPS2Raster, FigFile, /PNG

END
------------------------------

Thanks in advance,
Regards,
Madhavan

On Thursday, January 15, 2015 at 3:06:42 PM UTC+1, Jeff B wrote:
>> cgLoadCT, 22, /Brewer
>> tvlct, 0, 0, 0, 0
>> tvlct, 255, 255, 255, 255
>>
>> cgColorbar, /Brewer, CTindex=22, TCharsize=0.12, $
>> range=[minval,maxval],/right, tlocation='right', $
>> Title='d',/Vertical, Font=-1, Minor=5, $
>> Position=[0.81,0.32,0.83,0.90]
>
>
> Firstly, you need to add NCOLORS = 6 to both cgLoadCT and cgColorbar, Secondly, don't use the BREWER and CTINDEX keywords when you call cgColorbar; you have already loaded the color table you want. See the difference between
>
> cgLoadCT, 22, /brewer, nColors = 6
> cgColorbar, nColors = 6
>
> and
>
> cgLoadCT, 22, /brewer, nColors = 6
> cgColorbar, /brewer, ctIndex = 22, nColors = 6
>
> The last one does not use the color table you have loaded with cgLoadCT. Also note that when you do
>
> tvlct, 0, 0, 0, 0
>
> you are overwriting the first element of the color table. Therefore, black becomes one of the six colors you are using. If this is not the desired behavior, then perhaps you should place this outside the first six elements. I suggest using cIndex to look at what this does to your color table.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: When with the Linux version switch from Motif's to a modern toolkit?
Next Topic: Colors for the Color Blind

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

Current Time: Wed Oct 08 16:03:23 PDT 2025

Total time taken to generate the page: 0.00420 seconds