[ncl-talk] annotated map on contour plot is transparent rather than white
Guido Cioni
guidocioni at gmail.com
Mon Feb 22 03:14:10 MST 2016
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 <http://guidocioni.altervista.org/>
> On 22 Feb 2016, at 10:56, Jatin Kala <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/>http://guidocioni.altervista.org <http://guidocioni.altervista.org/>
>>
>>> On 22 Feb 2016, at 06:51, Jatin Kala < <mailto:jatin.kala.jk at gmail.com>jatin.kala.jk at gmail.com <mailto: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 <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/ <http://www.jatinkala.com/>
>
> <plot_Trudy_precip.ncl>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160222/5d0ec257/attachment.html
More information about the ncl-talk
mailing list