Commit dd84f64b authored by Sebastian Milinski's avatar Sebastian Milinski
Browse files

added legend, moved y-axis to right side and some other formatting changes

parent efae4cd9
......@@ -21,6 +21,7 @@ begin
;*************************************************
;*** settings ***
fastmode = 0
plotseason = 4 ; ( DJF | MAM | JJA | SON | yearmean )
if (all(isdefined((/"varname","optionstring"/)))) then
......@@ -284,17 +285,41 @@ print("Plotting...")
res2@gsnFrame = False ; don't advance frame to show all plots on the same page
res2@tiMainString = " " ; add title
res2@tiXAxisString = " ";"year"
res2@tiYAxisString = "GMST rel. to 1850-1900 [K]"
res2@tiYAxisString = "K";"GMST rel. to 1850-1900 [K]"
res2@tiYAxisAngleF = 0.
res2@xyDashPattern = 0 ; Make curves all solid
res2@xyLineColor = "blue"
res2@pmLegendDisplayMode = "Never"
res2@vpHeightF = .6
res2@vpHeightF = 2.0
res2@vpWidthF = 3.0
res2@trYMinF = -0.4
res2@trYMaxF = 1.0
res2@tmXBMode = "Manual"
res2@tmYRBorderOn = False
res2@tmYROn = False
res2@trYMinF = -1.0
res2@trYMaxF = 4.5
res2@tmYLMode = "Explicit"
res2@tmYLValues = (/0.,1.,2.,3.,4./)
res2@tmYLLabels = "" + res2@tmYLValues
res2@tmYLMinorValues = tofloat(ispan(-2,42,2))/10
print(res2@tmYLMinorValues)
; res2@tmYRMinorValues = (/0.2,0.3/)
; res2@tmYRMinorLengthF = 0.01
; res2@tmYLMinorOn = True
; res2@tmYRMinorOn = True
; res2@tmYLMinorLengthF = 0.01
; res2@tmYLMinorOutwardLengthF = 0.015
res2@tmYRLabelsOn = True
res2@tiYAxisSide = "Right" ; put the Y-axis title on the right
res2@tmYLBorderOn = False
res2@tmYLOn = False
res2@tmXTBorderOn = False
res2@tmXTOn = False
......@@ -313,7 +338,7 @@ print("Plotting...")
; panel plot res
;*************************************************
resP = True ; modify the panel plot
resP@txString = " "
resP@txString = "GMST relative to 1850-1900 mean"
resP@gsnFrame = False
resP@gsnPanelLabelBar = False ; add common colorbar
......@@ -326,20 +351,21 @@ print("Plotting...")
;************************************************
; Set resources for customizing a simple legend
;************************************************
; genres = True
; genres@XPosPercent = 10 ; move to the right
; genres@ItemSpacePercent = 6
; textres = True
; textres@lgLabelFontHeights = 0.015
; textres@lgLabels = (/"ensemble stddev",polyorder + "th-order polyfit", runave_length + "-year runmean"/)
; textres@lgPerimOn = False ; no perimeter
; textres@lgItemCount = 3 ; how many
; lineres = True
; lineres@lgLineThicknesses = 3 ; line thickness
; lineres@LineLengthPercent = 8 ; expressed as %, 0->100, length of line
; lineres@lgLineLabelFontHeights = 0.015 ; font height
; lineres@lgDashIndex = 0 ; line patterns
; lineres@lgLineColors = (/"red","black","blue"/)
genres = True
genres@XPosPercent = 10 ; move to the right
genres@YPosPercent = 70 ; move up
genres@ItemSpacePercent = 6
textres = True
textres@lgLabelFontHeights = 0.07
textres@lgLabels = (/"RCP8.5","RCP4.5","RCP2.6","historical"/)
textres@lgPerimOn = False ; no perimeter
textres@lgItemCount = 4 ; how many
lineres = True
lineres@lgLineThicknesses = 10 ; line thickness
lineres@LineLengthPercent = 8 ; expressed as %, 0->100, length of line
lineres@lgLineLabelFontHeights = 0.015 ; font height
lineres@lgDashIndex = 0 ; line patterns
lineres@lgLineColors = (/"magenta1","palegreen","gold","lightskyblue"/)
......@@ -399,15 +425,18 @@ print("Plotting...")
res2@trXMinF = floor(min(data_hist_seas&year))
res2@trXMaxF = ceil(max(data_rcp26_seas&year))
res2@tmXBTickStartF = res2@trXMinF
res2@tmYLMinorOn = False
res2@trYMinF = -1.0
res2@trYMaxF = 4.5
; res2@tmYLMinorOn = False
linewidth(0) = 2.0
res2@xyLineThicknesses = linewidth
linecol(0,:) = namedcolor2rgba("lightskyblue")
res2@xyLineColors = linecol
ens_hist = gsn_csm_xy(wks,data_hist_seas&year,data_hist_seas(season|plotseason,ens|:,year|:),res2) ; create plot
if (fastmode .eq. 0) then
ens_hist = gsn_csm_xy(wks,data_hist_seas&year,data_hist_seas(season|plotseason,ens|:,year|:),res2)
else
ens_hist = gsn_csm_xy(wks,data_hist_seas&year,data_hist_seas(season|plotseason,ens|0,year|:),res2)
end if
linewidth(0) = 4.0
res2@xyLineThicknesses = linewidth
linecol(0,:) = namedcolor2rgba("blue")
......@@ -419,7 +448,11 @@ print("Plotting...")
rgba = namedcolor2rgba("lightpink")
linecol(:,:) = conform(linecol,rgba(0,:),1)
res2@xyLineColors = linecol
ens_onepct = gsn_csm_xy(wks,data_onepct_seas&year,data_onepct_seas(season|plotseason,ens|:,year|:),res2) ; create plot
if (fastmode .eq. 0) then
ens_onepct = gsn_csm_xy(wks,data_onepct_seas&year,data_onepct_seas(season|plotseason,ens|:,year|:),res2)
else
ens_onepct = gsn_csm_xy(wks,data_onepct_seas&year,data_onepct_seas(season|plotseason,ens|0,year|:),res2)
end if
linewidth(0) = 4.0
res2@xyLineThicknesses = linewidth
linecol(0,:) = namedcolor2rgba("red")
......@@ -432,7 +465,11 @@ print("Plotting...")
rgba = namedcolor2rgba("gold")
linecol(:,:) = conform(linecol,rgba(0,:),1)
res2@xyLineColors = linecol
ens_rcp26 = gsn_csm_xy(wks,data_rcp26_seas&year-1,data_rcp26_seas(season|plotseason,ens|:,year|:),res2) ; create plot
if (fastmode .eq. 0) then
ens_rcp26 = gsn_csm_xy(wks,data_rcp26_seas&year-1,data_rcp26_seas(season|plotseason,ens|:,year|:),res2)
else
ens_rcp26 = gsn_csm_xy(wks,data_rcp26_seas&year-1,data_rcp26_seas(season|plotseason,ens|0,year|:),res2)
end if
linewidth(0) = 4.0
res2@xyLineThicknesses = linewidth
linecol(0,:) = namedcolor2rgba("goldenrod4")
......@@ -445,7 +482,11 @@ print("Plotting...")
rgba = namedcolor2rgba("palegreen")
linecol(:,:) = conform(linecol,rgba(0,:),1)
res2@xyLineColors = linecol
ens_rcp45 = gsn_csm_xy(wks,data_rcp45_seas&year-1,data_rcp45_seas(season|plotseason,ens|:,year|:),res2) ; create plot
if (fastmode .eq. 0) then
ens_rcp45 = gsn_csm_xy(wks,data_rcp45_seas&year-1,data_rcp45_seas(season|plotseason,ens|:,year|:),res2)
else
ens_rcp45 = gsn_csm_xy(wks,data_rcp45_seas&year-1,data_rcp45_seas(season|plotseason,ens|0,year|:),res2)
end if
linewidth(0) = 4.0
res2@xyLineThicknesses = linewidth
linecol(0,:) = namedcolor2rgba("green4")
......@@ -458,7 +499,11 @@ print("Plotting...")
rgba = namedcolor2rgba("magenta1")
linecol(:,:) = conform(linecol,rgba(0,:),1)
res2@xyLineColors = linecol
ens_rcp85 = gsn_csm_xy(wks,data_rcp85_seas&year-1,data_rcp85_seas(season|plotseason,ens|:,year|:),res2) ; create plot
if (fastmode .eq. 0) then
ens_rcp85 = gsn_csm_xy(wks,data_rcp85_seas&year-1,data_rcp85_seas(season|plotseason,ens|:,year|:),res2)
else
ens_rcp85 = gsn_csm_xy(wks,data_rcp85_seas&year-1,data_rcp85_seas(season|plotseason,ens|0,year|:),res2)
end if
linewidth(0) = 4.0
res2@xyLineThicknesses = linewidth
linecol(0,:) = namedcolor2rgba("magenta4")
......@@ -479,6 +524,7 @@ print("Plotting...")
overlay(ens_hist,ensmean_rcp85)
; overlay(ens_hist,obs)
legend1 = simple_legend(wks, ens_hist, genres, lineres, textres)
gsn_panel(wks,ens_hist,(/1,1/),resP)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment