[ncl-talk] Overlay of XY plot is not occurring
Atul Saini
atulsainimail at gmail.com
Wed Nov 13 05:44:03 MST 2019
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,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191113/91dd0f3a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xy.png
Type: image/png
Size: 71251 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191113/91dd0f3a/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: XY_Temp_Overlay.ncl
Type: application/octet-stream
Size: 2773 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191113/91dd0f3a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HP_Temp.nc
Type: application/x-netcdf
Size: 4376 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191113/91dd0f3a/attachment.nc>
More information about the ncl-talk
mailing list