[ncl-talk] multiple colorbars on panel plot

Mary Haley haley at ucar.edu
Mon Aug 27 13:41:36 MDT 2018


If I may interject: in general, if you want to use multiple color maps on a
page, I suggest using cnFillPalette instead of gsn_define_colormap.
cnFillPalette allows you to associate a color map directly with a contour
plot, and you don't have to worry about what order you draw things in.

See panel_26.ncl at:

http://www.ncl.ucar.edu/Applications/panel.shtml#ex26

Since you got things to work, it's not necessary to switch to this method.
Using gsn_define_colormap is perfectly valid.

--Mary


On Mon, Aug 27, 2018 at 1:29 PM, Laura Fowler <laura at ucar.edu> wrote:

> Hi Adam:
>
> You were right, of course. I am not sure what I was thinking. Here is my
> updated plot.
> Many thanks again,
> Laura
>
>
> On Mon, Aug 27, 2018 at 12:30 PM, Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Laura,
>> You have to create *and draw* the plots with the 1st colormap before you
>> switch to the 2nd colormap and create the last two plots.
>>
>> Looking at test.ncl (and going with the 4-panel plot you're now making)
>> you need to call gsn_panel and draw plot_B(:1) before you switch the
>> colormap and create plot_B(2:3). Order of script:
>> 1) Create plot_B(0) and plot_B(1).
>> 2) Set gsnPanelTop and gsnPanelBottom; call gsn_panel and draw those two
>> plots.
>> 3) Switch the colormap.
>> 4) Create plot_B(2) and plot_B(3).
>> 5) Set gsnPanelTop and gsnPanelBottom; call gsn_panel and draw
>> plot_B(2:3).
>> 6) Advance the frame.
>>
>> Adam
>>
>> On Mon, Aug 27, 2018 at 12:20 PM Laura Fowler <laura at ucar.edu> wrote:
>>
>>> Hi Adam:
>>>
>>> Unfortunately, it did not work for me. I may have misunderstood the
>>> changes that I needed to make. In my script, I call gsn_define_colormap
>>> before plotting the individual plots since I have a colorbar under each
>>> individual plot. So even when I called gsn_panel for the first 4 plots, I
>>> still get the colorbar that I called last.
>>>
>>> Here is the updated plot where now the 4 top plots use the one I
>>> assigned to the difference plot. See test.ncl in
>>> /gpfs/fs1/scratch/laura/
>>>
>>> Many thanks,
>>> Laura
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Aug 27, 2018 at 11:58 AM, Adam Phillips <asphilli at ucar.edu>
>>> wrote:
>>>
>>>> Hi Laura,
>>>> Yes, you should call gsn_panel twice, drawing the first 4 plots in the
>>>> first call and the last two plots in the second call. Something like this:
>>>>
>>>> ; create plots 1-4
>>>>
>>>> panres = True
>>>> panres at gsnFrame = False
>>>> panres at gsnPanelTop = .95
>>>> panres at gsnPanelBottom = .35
>>>> gsn_panel(wks,plot(:3),(/2,2/),panres)
>>>>
>>>> ; switch colormap and create plots 5-6
>>>>
>>>> panres at gsnPanelTop = .35
>>>> panres at gsnPanelBottom = .05
>>>> gsn_panel(wks,plot(4:),(/1,2/),panres)
>>>> frame(wks)
>>>>
>>>> The gsnPanelTop/gsnPanelBottom settings for each gsn_panel call might
>>>> have to be adjusted.
>>>> Hope that helps, if you have further questions let ncl-talk know.
>>>> Adam
>>>>
>>>> On Mon, Aug 27, 2018 at 11:49 AM Laura Fowler <laura at ucar.edu> wrote:
>>>>
>>>>> Hello:
>>>>>
>>>>> I am attaching a plot that shows 6 different plots in one panel plot.
>>>>> The two bottom plots e) and f) are differences of the two plots above them.
>>>>> The plots a) b), c), and d) use my user define colorbar.
>>>>>
>>>>> Is there a way to use the colorbar precip_diff_12lev instead of my own
>>>>> colorbar for the bottom 2 plots so that I can have white in the middle
>>>>> since it is a different plot while using my own colorbar for the top 4
>>>>> plots? When I redefine gsn_colormap before plotting the last 2 plots, then
>>>>> all 6 plots use colorbar precip_diff_12lev? I put my ncl script in
>>>>> /gpfs/fs1/scratch/laura/panel.dqvcup.ncl in case one wants to take a
>>>>> pick?
>>>>>
>>>>>
>>>>> Thanks,
>>>>> Laura
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> !-----------------------------------------------------------
>>>>> --------------------------------------------------
>>>>> Laura D. Fowler
>>>>>
>>>>> Mesoscale and Microscale Meteorology Division (MMM)
>>>>> National Center for Atmospheric Research
>>>>> P.O. Box 3000, Boulder CO 80307-3000
>>>>>
>>>>> e-mail: laura at ucar.edu
>>>>> phone: 303-497-1628
>>>>>
>>>>> !-----------------------------------------------------------
>>>>> --------------------------------------------------
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>
>>>>
>>>> --
>>>> Adam Phillips
>>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>>
>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>
>>>
>>>
>>>
>>> --
>>> !-----------------------------------------------------------
>>> --------------------------------------------------
>>> Laura D. Fowler
>>>
>>> Mesoscale and Microscale Meteorology Division (MMM)
>>> National Center for Atmospheric Research
>>> P.O. Box 3000, Boulder CO 80307-3000
>>>
>>> e-mail: laura at ucar.edu
>>> phone: 303-497-1628
>>>
>>> !-----------------------------------------------------------
>>> --------------------------------------------------
>>>
>>
>>
>> --
>> Adam Phillips
>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>
>> <http://www.cgd.ucar.edu/staff/asphilli>
>>
>
>
>
> --
> !-----------------------------------------------------------
> --------------------------------------------------
> Laura D. Fowler
>
> Mesoscale and Microscale Meteorology Division (MMM)
> National Center for Atmospheric Research
> P.O. Box 3000, Boulder CO 80307-3000
>
> e-mail: laura at ucar.edu
> phone: 303-497-1628
>
> !-----------------------------------------------------------
> --------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180827/d93139e6/attachment.html>


More information about the ncl-talk mailing list