[ncl-talk] Overlaying plots obtained through user defined procedures.

Mary Haley haley at ucar.edu
Tue Jan 5 10:30:15 MST 2016


Shilpa,

First, you need to modify mjo_wavenum_freq_season_plot so that it is a
function, and then have it return the plot, rather than just drawing it.
Then you would call it twice, as a function, returning a different variable
both times, and use "overlay" to overlay the plots

See the attached script.  I created a function called
mjo_wavenum_freq_season_plot_func,
which is almost identical to mjo_wavenum_freq_season_plot, except it now
requires you pass in the workstation, and it returns a plot.

In your own code, you will need to load this new function *after* you load
"diagnostics_cam.ncl".  Your code will look something like this:

load "./mjo_wavenum_freq_season_plot_func.ncl"
. . .
wks = gsn_open_wks("x11","myplot")
. . .
plot1 = mjo_wavenum_freq_season_plot_func(wks,...)
plot2 = mjo_wavenum_freq_season_plot_func(wks,...)

overlay(plot1,plot2)
draw(plot1)
frame(wks)

Note: this is all UNTESTED.  The overlay call assumes that both plot1 and
plot2 are in the same data space.  You may get some unwanted titles at the
top, which you will have to turn off yourself.

--Mary


On Tue, Jan 5, 2016 at 1:46 AM, Shilpa Malviya <shilpamalviya123 at gmail.com>
wrote:

> Hi all,
>
> How can overlay two plots created through the function
> "mjo_wavenum_freq_season_plot " ?
>
> Regards,
> Shilpa Malviya
>
> _______________________________________________
> 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/20160105/ee464ee1/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mjo_wavenum_freq_season_plot_func.ncl
Type: application/octet-stream
Size: 4717 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160105/ee464ee1/attachment.obj 


More information about the ncl-talk mailing list