[ncl-talk] Overlay of XY plot is not occurring
Atul Saini
atulsainimail at gmail.com
Wed Nov 13 06:07:44 MST 2019
Ohh god! How can I forget it? Sorry to bother you and Thanks a lot Dr.
Karin to let me know about the range. It is fine now.😄
Regards,
On Wed, Nov 13, 2019 at 6:27 PM Karin Meier-Fleischer via ncl-talk <
ncl-talk at ucar.edu> wrote:
> Hi Atul,
>
> your value range is wrong. You can use the printMinMax function to see the
> data range of the variables.
>
> printMinMax(tmean,0)
> printMinMax(tmin,0)
> printMinMax(tmax,0)
>
> Returns
>
> : min=23.9729 max=25.8099
> : min=18.8202 max=20.6115
> : min=28.7211 max=31.7591
>
> Add to the resources
>
> res at trYMinF = 18.
> res at trYMaxF = 32.
>
> And you define plot2 with variable tmax instead of tmin.
>
> plot2 = gsn_csm_xy(wks,time,tmin,res)
>
> -Karin
>
> Am 13.11.19 um 13:44 schrieb Atul Saini via ncl-talk:
>
> Hello All,
> *Please have a look at the data and below given script, it
> is not resulting into overlay.*
>
>
> begin
> a=addfile("HP_Temp.nc","r")
> tmean=a->tmean(:,0,0)
> tmin=a->tmin(:,0,0)
> tmax=a->tmax(:,0,0) ; read in right variable (y2)
> tmean_time=a->time(0:66) ; this is our x
> ;---Convert to fractional years for easier plotting.
> time=cd_calendar(tmean_time,4) ; scale for convenience
> ;---Start the graphics
> wks = gsn_open_wks("png","xy") ; send graphics to PNG file
> ;---Plotting options for time series plot
> res = True
> res at gsnMaximize = True
> res at gsnDraw = False ; Will draw later, after overlaying
> res at gsnFrame = False ; all plots
> res at vpWidthF = 0.8 ; Make plots wider
> res at vpHeightF = 0.4
> ;---Resources for legend
> res at pmLegendDisplayMode = "Always" ; turn on legend
> res at pmLegendWidthF = 0.12 ; Change width and
> res at pmLegendHeightF = 0.15 ; height of legend.
> res at pmLegendOrthogonalPosF = -0.08 ; move up slightly
> res at lgLabelFontHeightF = .011 ; change font height
> res at lgPerimOn = False ; no box around
> res at lgItemOrder = (/1,0/) ; reverse legend
> ;---Titles
> res at tiMainString = "Temperature"
> res at tiYAxisString = "Temp in Deg Celsius"
> ;---Turn off some tickmarks
> res at tmXTOn = False ; bottom off
> res at tmYROn = False ; right off
> res at xyLineThicknessF = 2.0 ; default is 1
> res at xyMonoDashPattern = True ; force all solid lines
> ;--------------------------------------------------
> ; The time_axis_label function adds additional
> ; resources to "res" to produce nicely-formatted
> ; time labels on X axis. This function only works
> ; if you have a time "units" recognized by the
> ; cd_calendar function.
> ;---------------------------------------------------
> ;---Set resources for colors and labels
> colors1 = (/"blue","red"/)
> colors2 = (/"darkgreen","darkorange"/)
> colors3 = (/"brown","purple"/)
> labels1 = "Tmean"
> labels2 = "Tmax"
> labels3 = "Tmin"
> ;---Create the four XY plots
> res at xyLineColors = colors1
> res at xyExplicitLegendLabels = labels1
> res at pmLegendParallelPosF = 0.15
> plot1 = gsn_csm_xy(wks,time,tmean,res)
> res at xyLineColors = colors2
> res at xyExplicitLegendLabels = labels2
> res at pmLegendParallelPosF = 0.37
> plot2 = gsn_csm_xy(wks,time,tmax,res)
> res at xyLineColors = colors3
> res at xyExplicitLegendLabels = labels3
> res at pmLegendParallelPosF = 0.59
> plot3 = gsn_csm_xy(wks,time,tmax,res)
> ;---Overlay one plot on the other, so they become one plot.
> overlay(plot1,plot2)
> overlay(plot1,plot3)
> draw(plot1) ; This will draw all four plots
> frame(wks)
> end
>
>
>
> Regards,
>
>
>
>
> _______________________________________________
> ncl-talk mailing listncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> 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/20191113/2222940a/attachment.html>
More information about the ncl-talk
mailing list