[ncl-talk] Issue regarding how to plot desirable variable only for a few months

Adam Phillips asphilli at ucar.edu
Fri May 13 12:35:54 MDT 2022


Hi Setareh,
Ah, I misread your email. Right now your code shows this for creating the
individual plots:
  do nmo=0,2                                  ; loop over the months
     res at gsnLeftString     = months(nmo)
     plot(nmo) = gsn_csm_contour_map(wks,anom(nmo,:,:), res)  ; create plot
  end do
    do nmo=9,11                                  ; loop over the months
     res at gsnLeftString     = months(nmo)
     plott(nmo) = gsn_csm_contour_map(wks,anom(nmo,:,:), res)  ; create plot
   end do

If you didn't want to change the above coding, you could call gsn_panel
like this:
gsn_panel(wks,(/plot(0),plot(1),plot(2),plott(9),plott(10),plott(11)/),(/2,3/),resP)

Adam


On Fri, May 13, 2022 at 12:29 PM Setareh Rahimi <setareh.rahimi at gmail.com>
wrote:

> Dear Adam,
> Thanks for your attention. But as  I mentioned, I need to plot only for 6
> months, hence:  ["January", "February", "March"  "October", "November",
> "December"]
> Best wishes,
>
> On Fri, May 13, 2022 at 10:54 PM Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Satareh,
>> If you want to simply plot the anomalies from the first 12 months of your
>> anom array, change this:
>>   do nmo=0,2                                  ; loop over the months
>>      res at gsnLeftString     = months(nmo)
>>      plot(nmo) = gsn_csm_contour_map(wks,anom(nmo,:,:), res)  ; create
>> plot
>>   end do
>>
>> to this:
>>   do nmo=0,11                                  ; loop over the months
>>      res at gsnLeftString     = months(nmo)
>>      plot(nmo) = gsn_csm_contour_map(wks,anom(nmo,:,:), res)  ; create
>> plot
>>   end do
>>
>> and change this:
>> gsn_panel(wks,plot,(/2,3/),resP)   ;=plot 2 rows by 3 columns
>> to this:
>> gsn_panel(wks,plot,(/4,3/),resP)   ;=plot 4 rows by 3 columns, = 12 plots
>> if all entries of plot are valid
>>
>> Hope that helps. If you have further questions please respond to ncl-talk.
>> Adam
>>
>> On Fri, May 13, 2022 at 9:49 AM Setareh Rahimi via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Dear all,
>>> I am trying to plot the monthly anomalies of temperature for my study
>>> area, for the following month: ["January", "February", "March"  "October",
>>> "November", "December"]. But my problem is that the script that I am
>>> running only plots for 3 months. Please advise me on how to fix this issue
>>> (script attached).
>>> Thanks in advance,
>>> Best wishes,
>>> --
>>> S.Rahimi
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at mailman.ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> https://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>
>>
>
>
> --
> S.Rahimi
>
>

-- 
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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220513/5d725918/attachment.html>


More information about the ncl-talk mailing list