[ncl-talk] annotated map on contour plot is transparent rather than white

Jatin Kala jatin.kala.jk at gmail.com
Mon Feb 22 03:20:59 MST 2016


Aha!
That was it, problem fixed by setting mpFillOn to True.
=)
Thanks for your help, i think the mpFillOn = False, came from one of the 
examples i copied from maps-only examples, which is fine for the map on 
it's own, but not when annotating to another plot.



On 22/02/2016 6:14 PM, Guido Cioni wrote:
> I’m pretty sure that the problem relies in the difference between xy 
> plot object and map object. The function that I gave you tries to fill 
> the space between lines with the specified color. However, when map 
> object is passed to the function, it is not able to find the lines so 
> that it doesn’t fill the space between…but that’s just my guess.
>
> Unfortunately now I can’t see your original plot attached, but have 
> you tried playing around with the map resources so that land/ocean 
> area are filled with color? (mpFillOn=True) Is there a particular 
> reason why are you using False?
>
> Guido Cioni
> http://guidocioni.altervista.org
>
>> On 22 Feb 2016, at 10:56, Jatin Kala <jatin.kala.jk at gmail.com 
>> <mailto:jatin.kala.jk at gmail.com>> wrote:
>>
>> Thanks Guido,
>> I don't know why, but it's not working in my script, the map is still 
>> transparent.
>> Modified script is attached.
>> Cheers,
>> Jatin
>>
>> On 22/02/2016 5:13 PM, Guido Cioni wrote:
>>> Hi Jatin,
>>> did you try creating a new function that fill the background of an 
>>> annotated plot?
>>>
>>> function fill_background(wks,plot,color)
>>> local xmin,xmax,ymin,yma,gres,xbox,ybox
>>> begin
>>> getvalues plot
>>> "trXMinF"  : xmin
>>> "trXMaxF"  : xmax
>>> "trYMinF"  : ymin
>>> "trYMaxF"  : ymax
>>>   end getvalues
>>>
>>>   xbox = (/xmin,xmax,xmax,xmin,xmin/)
>>>   ybox = (/ymin,ymin,ymax,ymax,ymin/)
>>>
>>> ;---Resources for filling the polygon
>>>   gres             = True
>>> gres at gsFillColor     = color
>>> gres at tfPolyDrawOrder = "PreDraw"    ; This is necessary so that the
>>>                             ; fill doesn't cover the curves.
>>>
>>> ;---Attach polygon to existing plot and return
>>>   dum = gsn_add_polygon(wks,plot,xbox,ybox,gres)
>>> return(dum)
>>> end
>>>
>>> Attached you find an example of an application with pdf and NCL 
>>> source file used to generate the plot.
>>> Hope this helps.
>>>
>>> Cheers
>>>
>>>
>>>
>>>
>>>
>>>
>>> Guido Cioni
>>> http://guidocioni.altervista.org
>>>
>>>> On 22 Feb 2016, at 06:51, Jatin Kala <jatin.kala.jk at gmail.com> wrote:
>>>>
>>>> Hi,
>>>> I am annotating a map on top of a contour plot. However, the map is 
>>>> being plotted as transparent rather than with white background.
>>>> See attached, any suggestions on how to fix this? I've tried a 
>>>> couple of things, none have worked so far.
>>>> Cheers,
>>>> Jatin
>>>> <plot_Trudy_precip.ncl><Trudy_precip_map.pdf>_______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>> -- 
>> Dr. Jatin Kala
>> Lecturer in Atmospheric Science
>> Murdoch University,Perth, Western Australia
>> Tel: (+618) 9360 6297
>> http://www.jatinkala.com/
>>
>> <plot_Trudy_precip.ncl>
>

-- 
Dr. Jatin Kala
Lecturer in Atmospheric Science
Murdoch University,Perth, Western Australia
Tel: (+618) 9360 6297
http://www.jatinkala.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160222/a0794350/attachment.html 


More information about the ncl-talk mailing list