Re: Complex panel plot w/ different coilor tables

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Jan 25 2011 - 09:51:19 MST

This is just some general info for users. Maurice used the correct solution.

NCL can only have one color table per page. If you draw some graphics to a page with one color table,
and then change color tables in mid page, the old graphics will use colors from the new color table.

Of course, if the old table and the new table share any colors, then you *might* get the results you expect or
close to the results. You have to be very careful with this.

We recommend that if you need to use two color tables, that you do just what Maurice did below, and
merge the two tables together before you start any drawing. Then, you can select the color index
ranges that you need.

You can see a simple example of this if you look at example 9 at:

http://www.ncl.ucar.edu/Applications/color.shtml#ex9

--Mary

On Jan 24, 2011, at 3:06 PM, Maurice.McHugh@noaa.gov wrote:

> Hi Adam,
>
> Thanks for your speedy response. I found that the actual labelbar used below both columns depended on which color table I used when I last invoked gsn_define_colormap.
>
> I couldn't work around it, so I went ahead and merged the colormaps and then segregated out the color-range depending on which variable I was plotting. The plots look perfect.
>
> Thanks again for your assistance,
>
> Maurice
>
>
> ----- Original Message -----
> From: Adam Phillips <asphilli@ucar.edu>
> Date: Monday, January 24, 2011 4:24 pm
> Subject: Re: Complex panel plot w/ different coilor tables
> To: ncl-talk@ucar.edu
>
>
>> Hi Maurice,
>> I have managed to use different colomaps on the same page by utilizing
>>
>> the procedure shown in unique plots example #3 here:
>>
>>
>> (I know this technique works for .ps format but I am not sure if it
>> works for other output formats (x11, eps)..) The key is to make sure
>> that the first column of plots is actually drawn before you switch to
>>
>> your second colormap.
>>
>> I think you are doing that, in that by default gsn_panel draws the
>> plot(s) (and advances the frame). So I'm a little confused as to why
>> the
>> 1st label bar is not reflecting the colors of the first column.
>>
>> If you simply make your first gsn_panel call and call frame(wks), does
>>
>> the label bar beneath the column reflect the colors used of the first
>>
>> column? Assuming the answer to is yes, then that means that the 2nd
>> call
>> to gsn_panel is somehow affecting the first column's labelbar..
>> Instead
>> of using gsnPanelLabelBar, can you set lbLabelBarOn = False for the
>> first three panels of each plot and then set it to True for the 4th
>> panel? (You might have to set gsnPanelBottom = 0.07 or something
>> similar
>> to leave room at the bottom of the page for the label bar.)
>>
>> A 2nd possibility: Merge your two colormaps using gsn_merge_colormaps,
>>
>> and then explicitly select the colors to be used for each set of
>> plots.
>> Note that your workstation color limit is 256 colors.
>>
>> Hope that helps..
>> Adam
>>
>> On 01/24/2011 01:58 PM, Maurice.McHugh@noaa.gov wrote:
>>> Dear NCL-ers.
>>>
>>> Apologies if you receive this twice.
>>>
>>> I am trying to make a complex panel plot displaying 2 variables
>> (temp. and precip. biases) using different color tables. My script
>> mimics code in and is *Ualmost* right. The LHS column (temp.) and
>> RHS column (precip.) both look fine and use their different color
>> tables, and have seperate labelbars beneath each column. However, the
>> issue I cannot solve is that the colors of the colorbar only come from
>> the color table for precip -- the RHS column which was drawn last.
>>>
>>> How can I insert the correct label bar for the temperature column?
>> I really don't want to have precip and temperature differences use the
>> same color table. Nor do I want to split into two seperate plots.
>>>
>>> The misbehaving plot is attached, and relevant code snippet is below.
>>>
>>> Many thanks,
>>>
>>> Maurice
>>>
>>> ;--------------------------------------------------------------------------------------------------------
>>> ; Create panel. plotT and plotP are the graphical arrays
>> containing the individual
>>> ; Temp and Precip plots for paneling.
>>> ;--------------------------------------------------------------------------------------------------------
>>>
>>> resP = True ; modify the panel
>> plot
>>> resP@gsnPanelLabelBar = True ; add common colorbar
>>> resP@lbLabelFontHeightF = 0.007 ; make labels smaller
>>> resP@gsnFrame = False ; don't advance
>> panel plot
>>>
>>> resP@gsnPanelYWhiteSpacePercent = 2.5
>>> resP@gsnPanelXWhiteSpacePercent = 2.5
>>>
>>> resP@gsnPanelFigureStrings= (/ "a)","c)","e)","g)" /) ; add
>> strings to panel
>>> resP@txFontHeightF = .24
>>>
>>> resP@gsnMaximize = True
>>>
>>> resP@gsnPanelRight = 0.5 ; draw from left
>> edge to center
>>>
>>> gsn_panel(wks,plotT,(/4,1/),resP) ; now draw as one
>> plot
>>>
>>> ;--------------------------------------------------------------------------------------------------------
>>> ;--------------------------------------------------------------------------------------------------------
>>>
>>> resP2 = True
>>> resP2@gsnPanelLabelBar = True ; add common colorbar
>>> resP2@lbLabelFontHeightF = 0.007 ; make labels smaller
>>> resP2@gsnFrame = False ; don't advance
>> panel plot
>>>
>>> resP2@gsnPanelYWhiteSpacePercent = 2.5
>>> resP2@gsnPanelXWhiteSpacePercent = 2.5
>>>
>>> resP2@txFontHeightF = .24
>>>
>>> resP2@gsnMaximize = True
>>> resP2@gsnPanelFigureStrings= (/ "b)","d)","f)","h)" /) ; add
>> strings to panel
>>> resP2@gsnPanelLeft = 0.5 ; draw
>> from center to right edge
>>>
>>> gsn_panel(wks,plotP,(/4,1/),resP2) ; now draw as
>> one plot
>>>
>>> ;--------------------------------------------------------------------------------------------------------
>>> ; Add column labels to panel.
>>> ;--------------------------------------------------------------------------------------------------------
>>> txres = True
>>> txres@txFontHeightF = 0.0165
>>> gsn_text_ndc(wks,"RegCM",0.1,0.99,txres)
>>> gsn_text_ndc(wks,"CRU",0.9,0.99,txres)
>>> frame(wks)
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>>
>>
>> --
>> __________________________________________________
>> Adam Phillips
>> asphilli@ucar.edu
>> National Center for Atmospheric Research tel: (303) 497-1726
>> Climate and Global Dynamics Division fax: (303) 497-1333
>> P.O. Box 3000
>> Boulder, CO 80307-3000
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jan 25 09:51:27 2011

This archive was generated by hypermail 2.1.8 : Tue Jan 25 2011 - 14:22:15 MST