[ncl-talk] Dividing a legend over 2 cells in a matrix plot
Toni Klemm
toni-klemm at tamu.edu
Mon Jul 30 12:45:39 MDT 2018
Hi Adam,
The legend now appears in the plot matrix, but it’s too large and overlaps with the other plots. I attached it again.
I tried to incorporate your suggestions as best I could, but I my script structure might be different from yours, so I might have done it wrong. I included my script below.
I used lgLabelFontHeightF, vpWidthF, and vpHeightF at the end of the script to reduce the size but it didn’t work. I also set lgAutoManage = False , just in case, but I still wasn’t able to change the size.
Thank you again for your help!
Toni
Toni Klemm, Ph.D.
Postdoctoral Research Associate
Department of Ecosystem Science and Management
Texas A&M University, College Station, TX
Contributor at the Early Career Climate Forum <http://www.eccforum.org/>
www.toni-klemm.de <http://www.toni-klemm.de/> | @toniklemm <http://twitter.com/toniklemm>
; Create time series plots of NPP stored in the 9 different functional groups in each climate zone
; 9 groups per plot, 16 plots (zones) per matrix
; ---------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "~/NIFA/NCL_6.5.0_functions/simple_legend_ndc.ncl"
; ---------------------------------------------------
begin
RCP_list = [/"rcp_45","rcp_85"/]
fs_list = [/"fs","nfs"/]
model_list = [/"CCSM4","GFDL-ESM2M","HadGEM2-ES365","IPSL-CM5A-LR","MRI-CGCM3"/]
RCP_title = [/"RCP 4.5","RCP 8.5"/]
fs_title = [/"Fire Suppr. on","Fire Suppr. off"/]
model_title = [/"CCSM4","GFDL-ESM2M","HadGEM2-ES365","IPSL-CM5A-LR","MRI-CGCM3"/]
do h = 0, ListCount(RCP_list) - 1
do i = 0, ListCount(fs_list) - 1
do j = 0, ListCount(model_list) - 1
; ***********************************************
; 1 - READ IN MC2 FILE
; ***********************************************
print("")
print("~/NIFA/MC2/subset_climate_zones/" + RCP_list[h](0) + "/" + fs_list[i](0) + "/" + model_list[j](0))
print("1 - Read in files")
diri = "~/NIFA/MC2/subset_climate_zones/" + RCP_list[h](0) + "/" + fs_list[i](0) + "/" + model_list[j](0) + "/NPP_GROUPED/"
zone_01_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_01.nc","r")
zone_02_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_02.nc","r")
zone_03_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_03.nc","r")
zone_04_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_04.nc","r")
zone_05_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_05.nc","r")
zone_06_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_06.nc","r")
zone_07_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_07.nc","r")
zone_08_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_08.nc","r")
zone_09_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_09.nc","r")
zone_10_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_10.nc","r")
zone_11_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_11.nc","r")
zone_12_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_12.nc","r")
zone_13_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_13.nc","r")
zone_14_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_14.nc","r")
zone_15_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_15.nc","r")
zone_16_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_grouped_zone_16.nc","r")
; ***********************************************
; 2 - CREATE MATRIX PLOT
; ***********************************************
print("2 - Create Plot Matrix")
diro = "~/NIFA/MC2/subset_climate_zones/time_series/NPP/all_zones_all_groups/"
filo = RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_NPP_percentage_all_zones_all_groups_TEST_simple_legend_ndc"
wks_type = "png" ; plot file type
wks_type at wkWidth = 3500 ; width dimension
wks_type at wkHeight = 3500 ; height dimension
wks = gsn_open_wks(wks_type, diro + filo)
gsn_define_colormap(wks,"wgne15") ; define colormap
;*********************************************
; PLOT MATRIX PARAMETERS
;*********************************************
res = True
res at trYMinF = 0 ; min y axis value
res at trYMaxF = 100 ; max y axis value
res at trXMinF = 2015 ; min y axis value
res at trXMaxF = 2100 ; max x axis value
res at tmXBMinorOn = True ; turn off minor tickmarks
res at tmYLMinorOn = True
res at tmXTOn = False ; turn off top tickmarks
res at tmYROn = False ; turn off right tickmarks
res at tmXTBorderOn = False ; turn off top axis
res at tmYRBorderOn = False ; turn off right axis
res at tiXAxisString = "Years" ; titles
res at tiYAxisString = "%"
res at tmYLLabelFontHeightF = 0.03 ; set font heights
res at gsnRightStringFontHeightF = 0.03
res at tiXAxisFontHeightF = 0.03
res at tiYAxisFontHeightF = 0.03
res at vpWidthF = .8 ; change aspect ratio
res at vpHeightF = .4
res at gsnDraw = False ; don't draw or advance the frame
res at gsnFrame = False
res at xyDashPattern = 0 ; Make curves all solid
res at xyLineColors := (/"blue","red","orange","black","green","pink","brown","purple","grey"/) ; 9 different colors
res at xyLineThicknesses = (/10,10,10,10,10,10,10,10,10/) ; make second line thicker
plot = new(18,graphic) ; create 18-plot array
x = (/0,1/) ; arrays for fack axis
y = (/0,0/)
do gg = 0,15
plot(gg) = gsn_csm_xy(wks,x,y,res)
end do
;*********************************************
; READ IN PLOT VARIABLES
;*********************************************
print("3 - Read in plot variables")
year = zone_01_f->year
units = "%"
data_01 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_02 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_03 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_04 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_05 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_06 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_07 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_08 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_09 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_10 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_11 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_12 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_13 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_14 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_15 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
data_16 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
print("3a - Zone 1")
data_01(0,:) = zone_01_f->NPP_C3G_percentage
data_01(1,:) = zone_01_f->NPP_C3S_percentage
data_01(2,:) = zone_01_f->NPP_C4G_percentage
data_01(3,:) = zone_01_f->NPP_C4S_percentage
data_01(4,:) = zone_01_f->NPP_OTHER_percentage
data_01(5,:) = zone_01_f->NPP_SF_percentage
data_01(6,:) = zone_01_f->NPP_SW_percentage
data_01(7,:) = zone_01_f->NPP_TF_percentage
data_01(8,:) = zone_01_f->NPP_TW_percentage
ALL_data_01 = zone_01_f->NPP_ALL_annual
print("3a - Zone 2")
data_02(0,:) = zone_02_f->NPP_C3G_percentage
data_02(1,:) = zone_02_f->NPP_C3S_percentage
data_02(2,:) = zone_02_f->NPP_C4G_percentage
data_02(3,:) = zone_02_f->NPP_C4S_percentage
data_02(4,:) = zone_02_f->NPP_OTHER_percentage
data_02(5,:) = zone_02_f->NPP_SF_percentage
data_02(6,:) = zone_02_f->NPP_SW_percentage
data_02(7,:) = zone_02_f->NPP_TF_percentage
data_02(8,:) = zone_02_f->NPP_TW_percentage
ALL_data_02 = zone_02_f->NPP_ALL_annual
print("3a - Zone 3")
data_03(0,:) = zone_03_f->NPP_C3G_percentage
data_03(1,:) = zone_03_f->NPP_C3S_percentage
data_03(2,:) = zone_03_f->NPP_C4G_percentage
data_03(3,:) = zone_03_f->NPP_C4S_percentage
data_03(4,:) = zone_03_f->NPP_OTHER_percentage
data_03(5,:) = zone_03_f->NPP_SF_percentage
data_03(6,:) = zone_03_f->NPP_SW_percentage
data_03(7,:) = zone_03_f->NPP_TF_percentage
data_03(8,:) = zone_03_f->NPP_TW_percentage
ALL_data_03 = zone_03_f->NPP_ALL_annual
print("3a - Zone 4")
data_04(0,:) = zone_04_f->NPP_C3G_percentage
data_04(1,:) = zone_04_f->NPP_C3S_percentage
data_04(2,:) = zone_04_f->NPP_C4G_percentage
data_04(3,:) = zone_04_f->NPP_C4S_percentage
data_04(4,:) = zone_04_f->NPP_OTHER_percentage
data_04(5,:) = zone_04_f->NPP_SF_percentage
data_04(6,:) = zone_04_f->NPP_SW_percentage
data_04(7,:) = zone_04_f->NPP_TF_percentage
data_04(8,:) = zone_04_f->NPP_TW_percentage
ALL_data_04 = zone_04_f->NPP_ALL_annual
print("3a - Zone 5")
data_05(0,:) = zone_05_f->NPP_C3G_percentage
data_05(1,:) = zone_05_f->NPP_C3S_percentage
data_05(2,:) = zone_05_f->NPP_C4G_percentage
data_05(3,:) = zone_05_f->NPP_C4S_percentage
data_05(4,:) = zone_05_f->NPP_OTHER_percentage
data_05(5,:) = zone_05_f->NPP_SF_percentage
data_05(6,:) = zone_05_f->NPP_SW_percentage
data_05(7,:) = zone_05_f->NPP_TF_percentage
data_05(8,:) = zone_05_f->NPP_TW_percentage
ALL_data_05 = zone_05_f->NPP_ALL_annual
print("3a - Zone 6")
data_06(0,:) = zone_06_f->NPP_C3G_percentage
data_06(1,:) = zone_06_f->NPP_C3S_percentage
data_06(2,:) = zone_06_f->NPP_C4G_percentage
data_06(3,:) = zone_06_f->NPP_C4S_percentage
data_06(4,:) = zone_06_f->NPP_OTHER_percentage
data_06(5,:) = zone_06_f->NPP_SF_percentage
data_06(6,:) = zone_06_f->NPP_SW_percentage
data_06(7,:) = zone_06_f->NPP_TF_percentage
data_06(8,:) = zone_06_f->NPP_TW_percentage
ALL_data_06 = zone_06_f->NPP_ALL_annual
print("3a - Zone 7")
data_07(0,:) = zone_07_f->NPP_C3G_percentage
data_07(1,:) = zone_07_f->NPP_C3S_percentage
data_07(2,:) = zone_07_f->NPP_C4G_percentage
data_07(3,:) = zone_07_f->NPP_C4S_percentage
data_07(4,:) = zone_07_f->NPP_OTHER_percentage
data_07(5,:) = zone_07_f->NPP_SF_percentage
data_07(6,:) = zone_07_f->NPP_SW_percentage
data_07(7,:) = zone_07_f->NPP_TF_percentage
data_07(8,:) = zone_07_f->NPP_TW_percentage
ALL_data_07 = zone_07_f->NPP_ALL_annual
print("3a - Zone 8")
data_08(0,:) = zone_08_f->NPP_C3G_percentage
data_08(1,:) = zone_08_f->NPP_C3S_percentage
data_08(2,:) = zone_08_f->NPP_C4G_percentage
data_08(3,:) = zone_08_f->NPP_C4S_percentage
data_08(4,:) = zone_08_f->NPP_OTHER_percentage
data_08(5,:) = zone_08_f->NPP_SF_percentage
data_08(6,:) = zone_08_f->NPP_SW_percentage
data_08(7,:) = zone_08_f->NPP_TF_percentage
data_08(8,:) = zone_08_f->NPP_TW_percentage
ALL_data_08 = zone_08_f->NPP_ALL_annual
print("3a - Zone 9")
data_09(0,:) = zone_09_f->NPP_C3G_percentage
data_09(1,:) = zone_09_f->NPP_C3S_percentage
data_09(2,:) = zone_09_f->NPP_C4G_percentage
data_09(3,:) = zone_09_f->NPP_C4S_percentage
data_09(4,:) = zone_09_f->NPP_OTHER_percentage
data_09(5,:) = zone_09_f->NPP_SF_percentage
data_09(6,:) = zone_09_f->NPP_SW_percentage
data_09(7,:) = zone_09_f->NPP_TF_percentage
data_09(8,:) = zone_09_f->NPP_TW_percentage
ALL_data_09 = zone_09_f->NPP_ALL_annual
print("3a - Zone 10")
data_10(0,:) = zone_10_f->NPP_C3G_percentage
data_10(1,:) = zone_10_f->NPP_C3S_percentage
data_10(2,:) = zone_10_f->NPP_C4G_percentage
data_10(3,:) = zone_10_f->NPP_C4S_percentage
data_10(4,:) = zone_10_f->NPP_OTHER_percentage
data_10(5,:) = zone_10_f->NPP_SF_percentage
data_10(6,:) = zone_10_f->NPP_SW_percentage
data_10(7,:) = zone_10_f->NPP_TF_percentage
data_10(8,:) = zone_10_f->NPP_TW_percentage
ALL_data_10 = zone_10_f->NPP_ALL_annual
print("3a - Zone 11")
data_11(0,:) = zone_11_f->NPP_C3G_percentage
data_11(1,:) = zone_11_f->NPP_C3S_percentage
data_11(2,:) = zone_11_f->NPP_C4G_percentage
data_11(3,:) = zone_11_f->NPP_C4S_percentage
data_11(4,:) = zone_11_f->NPP_OTHER_percentage
data_11(5,:) = zone_11_f->NPP_SF_percentage
data_11(6,:) = zone_11_f->NPP_SW_percentage
data_11(7,:) = zone_11_f->NPP_TF_percentage
data_11(8,:) = zone_11_f->NPP_TW_percentage
ALL_data_11 = zone_11_f->NPP_ALL_annual
print("3a - Zone 12")
data_12(0,:) = zone_12_f->NPP_C3G_percentage
data_12(1,:) = zone_12_f->NPP_C3S_percentage
data_12(2,:) = zone_12_f->NPP_C4G_percentage
data_12(3,:) = zone_12_f->NPP_C4S_percentage
data_12(4,:) = zone_12_f->NPP_OTHER_percentage
data_12(5,:) = zone_12_f->NPP_SF_percentage
data_12(6,:) = zone_12_f->NPP_SW_percentage
data_12(7,:) = zone_12_f->NPP_TF_percentage
data_12(8,:) = zone_12_f->NPP_TW_percentage
ALL_data_12 = zone_12_f->NPP_ALL_annual
print("3a - Zone 13")
data_13(0,:) = zone_13_f->NPP_C3G_percentage
data_13(1,:) = zone_13_f->NPP_C3S_percentage
data_13(2,:) = zone_13_f->NPP_C4G_percentage
data_13(3,:) = zone_13_f->NPP_C4S_percentage
data_13(4,:) = zone_13_f->NPP_OTHER_percentage
data_13(5,:) = zone_13_f->NPP_SF_percentage
data_13(6,:) = zone_13_f->NPP_SW_percentage
data_13(7,:) = zone_13_f->NPP_TF_percentage
data_13(8,:) = zone_13_f->NPP_TW_percentage
ALL_data_13 = zone_13_f->NPP_ALL_annual
print("3a - Zone 14")
data_14(0,:) = zone_14_f->NPP_C3G_percentage
data_14(1,:) = zone_14_f->NPP_C3S_percentage
data_14(2,:) = zone_14_f->NPP_C4G_percentage
data_14(3,:) = zone_14_f->NPP_C4S_percentage
data_14(4,:) = zone_14_f->NPP_OTHER_percentage
data_14(5,:) = zone_14_f->NPP_SF_percentage
data_14(6,:) = zone_14_f->NPP_SW_percentage
data_14(7,:) = zone_14_f->NPP_TF_percentage
data_14(8,:) = zone_14_f->NPP_TW_percentage
ALL_data_14 = zone_14_f->NPP_ALL_annual
print("3a - Zone 15")
data_15(0,:) = zone_15_f->NPP_C3G_percentage
data_15(1,:) = zone_15_f->NPP_C3S_percentage
data_15(2,:) = zone_15_f->NPP_C4G_percentage
data_15(3,:) = zone_15_f->NPP_C4S_percentage
data_15(4,:) = zone_15_f->NPP_OTHER_percentage
data_15(5,:) = zone_15_f->NPP_SF_percentage
data_15(6,:) = zone_15_f->NPP_SW_percentage
data_15(7,:) = zone_15_f->NPP_TF_percentage
data_15(8,:) = zone_15_f->NPP_TW_percentage
ALL_data_15 = zone_15_f->NPP_ALL_annual
print("3a - Zone 16")
data_16(0,:) = zone_16_f->NPP_C3G_percentage
data_16(1,:) = zone_16_f->NPP_C3S_percentage
data_16(2,:) = zone_16_f->NPP_C4G_percentage
data_16(3,:) = zone_16_f->NPP_C4S_percentage
data_16(4,:) = zone_16_f->NPP_OTHER_percentage
data_16(5,:) = zone_16_f->NPP_SF_percentage
data_16(6,:) = zone_16_f->NPP_SW_percentage
data_16(7,:) = zone_16_f->NPP_TF_percentage
data_16(8,:) = zone_16_f->NPP_TW_percentage
ALL_data_16 = zone_16_f->NPP_ALL_annual
;*********************************************************
; CREATE INDIVIDUAL PLOTS
;*********************************************************
print("4 - Create individual plots")
print("4a - Zone 1")
res at gsnRightString = "Zone 1" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_01,0)/1000000,1,True) + " t C m^-2"
plot(0) = gsn_csm_xy (wks,year,data_01,res) ; create plot
print("4a - Zone 2")
res at gsnRightString = "Zone 2" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_02,0)/1000000,1,True) + " t C m^-2"
plot(1) = gsn_csm_xy (wks,year,data_02,res) ; create plot
print("4a - Zone 3")
res at gsnRightString = "Zone 3" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_03,0)/1000000,1,True) + " t C m^-2"
plot(2) = gsn_csm_xy (wks,year,data_03,res) ; create plot
print("4a - Zone 4")
res at gsnRightString = "Zone 4" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_04,0)/1000000,1,True) + " t C m^-2"
plot(3) = gsn_csm_xy (wks,year,data_04,res) ; create plot
print("4a - Zone 5")
res at gsnRightString = "Zone 5" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_05,0)/1000000,1,True) + " t C m^-2"
plot(4) = gsn_csm_xy (wks,year,data_05,res) ; create plot
print("4a - Zone 6")
res at gsnRightString = "Zone 6" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_06,0)/1000000,1,True) + " t C m^-2"
plot(5) = gsn_csm_xy (wks,year,data_06,res) ; create plot
print("4a - Zone 7")
res at gsnRightString = "Zone 7" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_07,0)/1000000,1,True) + " t C m^-2"
plot(6) = gsn_csm_xy (wks,year,data_07,res) ; create plot
print("4a - Zone 8")
res at gsnRightString = "Zone 8" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_08,0)/1000000,1,True) + " t C m^-2"
plot(7) = gsn_csm_xy (wks,year,data_08,res) ; create plot
print("4a - Zone 9")
res at gsnRightString = "Zone 9" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_09,0)/1000000,1,True) + " t C m^-2"
plot(8) = gsn_csm_xy (wks,year,data_09,res) ; create plot
print("4a - Zone 10")
res at gsnRightString = "Zone 10" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_10,0)/1000000,1,True) + " t C m^-2"
plot(9) = gsn_csm_xy (wks,year,data_10,res) ; create plot
print("4a - Zone 11")
res at gsnRightString = "Zone 11" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_11,0)/1000000,1,True) + " t C m^-2"
plot(10) = gsn_csm_xy (wks,year,data_11,res) ; create plot
print("4a - Zone 12")
res at gsnRightString = "Zone 12" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_12,0)/1000000,1,True) + " t C m^-2"
plot(11) = gsn_csm_xy (wks,year,data_12,res) ; create plot
print("4a - Zone 13")
res at gsnRightString = "Zone 13" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_13,0)/1000000,1,True) + " t C m^-2"
plot(12) = gsn_csm_xy (wks,year,data_13,res) ; create plot
print("4a - Zone 14")
res at gsnRightString = "Zone 14" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_14,0)/1000000,1,True) + " t C m^-2"
plot(13) = gsn_csm_xy (wks,year,data_14,res) ; create plot
print("4a - Zone 15")
res at gsnRightString = "Zone 15" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_15,0)/1000000,1,True) + " t C m^-2"
plot(14) = gsn_csm_xy (wks,year,data_15,res) ; create plot
print("4a - Zone 16")
res at gsnRightString = "Zone 16" ; title
res at gsnLeftString = "Avg.: " + decimalPlaces(dim_avg_n(ALL_data_16,0)/1000000,1,True) + " t C m^-2"
plot(15) = gsn_csm_xy (wks,year,data_16,res) ; create plot
;***********************************************
; CREATING A LEGEND
;***********************************************
print("5 - Create legend")
gres = True
gres at YPosPercent = 25 ; expressed as %, 0->100, sets position of top border of legend
; when gres at Position is set to its default setting of "Top" (Default = 95.)
gres at XPosPercent = 50 ; expressed as %, 0->100, sets position of left border of legend(Default = 5.)
gres at vpHeightF = 0.5 ; height of legend (NDC)
gres at vpWidth = 1 ; height of legend (NDC)
lineres = True
lineres at lgAutoManage = False
lineres at lgLineColors = (/"blue","red","orange","black","green","pink","brown","purple","grey"/)
lineres at lgLineThicknesses = 10 ; line thicknesses
lineres at LineLengthPercent = 5. ; expressed as %, 0->100, length of line
textres = True
textres at lgAutoManage = False
textres at lgLabels = (/"C3 grassland","C3 shrubland","C4 grassland","C4 shrubland","Other","Subtropical forest","Subtropical woodland","Temperate forest","Temperate woodland"/) ; legend labels (required)
textres at lgLabelFontHeightF = .01 ; set the legend label font thickness
textres at vpHeightF = 0.5 ; height of legend (NDC)
textres at vpWidthF = 1 ; height of legend (NDC)
simple_legend_ndc(wks,gres,lineres,textres)
/;
var_long_name_01 = (/"C3 grassland","C3 shrubland","C4 grassland","C4 shrubland","Other"/)
var_long_name_02 = (/"Subtropical forest","Subtropical woodland","Temperate forest","Temperate woodland"/)
; line colors: "blue","red","orange","black","green","pink","brown","purple","grey"
; Legend elements 1-5
lgres = True
lgres at lgAutoManage = True
lgres at lgLineColors = (/"blue","red","orange","black","green"/)
lgres at lgLineThicknessF = res at xyLineThicknesses ; legend line thickness = contour line thickness
lgres at lgItemType = "Lines" ; show lines only (default)
lgres at lgItemCount = 5 ; Number of items
lgres at lgLabelFontHeightF = .04 ; set the legend label font thickness
lgres at vpWidthF = 1 ; width of legend (NDC)
lgres at vpHeightF = 1 ; height of legend (NDC)
lgres at lgPerimColor = "white" ; draw the box perimeter in orange
lgres at lgPerimThicknessF = 1.0 ; thicken the box perimeter
plot(16) = gsn_create_legend(wks,5,var_long_name_01,lgres) ; create legend
; Legend elements 6-9
gres = True
gres at YPosPercent = 5. ; expressed as %, 0->100, sets position of top border of legend
; 0 = bottom of plot, 100 = top of plot
gres at XPosPercent = 50 ; expressed as %, 0->100, sets position of left border of legend
; 0 = left side of plot
lgres = True
lgres at lgAutoManage = False
lgres at lgLineColors = (/"pink","brown","purple","grey"/)
lgres at lgLineThicknessF = res at xyLineThicknesses ; legend line thickness = 1/2 contour line thickness
lgres at lgItemType = "Lines" ; show lines only (default)
lgres at lgItemCount = 4 ; Number of items
lgres at lgLabelFontHeightF = .04 ; set the legend label font thickness
lgres at vpWidthF = 1 ; width of legend (NDC)
lgres at vpHeightF = 1 ; height of legend (NDC)
lgres at lgPerimColor = "white" ; draw the box perimeter in orange
lgres at lgPerimThicknessF = 1.0 ; thicken the box perimeter
plot(17) = gsn_create_legend(wks,gres,var_long_name_02,lgres) ; create legend
; Legend elements 1-9
lgres = True
lgres at lgAutoManage = False
lgres at lgLineColors = (/"blue","red","orange","black","green","pink","brown","purple","grey"/)
lgres at lgLineThicknessF = 5 ; legend line thickness
lgres at lgItemType = "Lines" ; show lines only (default)
lgres at lgItemCount = 9 ; Number of items
lgres at lgLabelFontHeightF = .01 ; set the legend label font thickness
lgres at vpWidthF = 0.5 ; width of legend (NDC)
lgres at vpHeightF = 1 ; height of legend (NDC)
lgres at lgPerimColor = "white" ; draw the box perimeter in orange
lgres at lgPerimThicknessF = 1.0 ; thicken the box perimeter
plot(16) = gsn_create_legend(wks,9,(/"C3-G","C3-S","C4-G","C4-S","Other","SF","SW","TF","TW"/),lgres) ; create legend
;/
;***********************************************
; panel plots together
;***********************************************
print("6 - Create plot matrix")
pres = True
pres at gsnMaximize = False
pres at gsnPanelRowSpec = True
pres at gsnPanelCenter = False
pres at gsnFrame = False
pres at gsnPanelXWhiteSpacePercent = 10 ; horizontal white space between columns in percent
pres at gsnPanelYWhiteSpacePercent = 5 ; vertical white space between rows in percent
pres at gsnPanelMainString = RCP_title[h](0) + " | " + fs_title[i](0) + " | " + model_title[j](0) + " | NPP per func. group"
pres at tiMainFontHeightF = 0.04
pres at tiMainFont = 21
pres at gsnPanelXF = (/-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1/)
gsn_panel(wks,plot,(/3,3,3,3,3,3/),pres)
frame(wks)
print("")
print("**** DONE ****")
delete([/diri,plot,diro,filo,wks,res,data_01,data_02,data_03,data_04,data_05,data_06,data_07,data_08,data_09,data_10,data_11,data_12,data_13,data_14,data_15,data_16,zone_01_f,zone_02_f,zone_03_f,zone_04_f,zone_05_f,zone_06_f,zone_07_f,zone_08_f,zone_09_f,zone_10_f,zone_11_f,zone_12_f,zone_13_f,zone_14_f,zone_15_f,zone_16_f,pres/])
sleep(10)
end do ; end model list loop
end do ; end fs list loop
end do ; end RCP list loop
print("**** ALL DONE ****")
end
> On Jul 30, 2018, at 12:18 PM, Adam Phillips <asphilli at ucar.edu> wrote:
>
> Hi Toni,
> The order should likely be something like this:
> res = True
> .....
> plot = new(16, graphic)
> do gg = 0,15
> plot(gg) = gsn_csm_xy(wks,...,res)
> end do
>
> panres = True ; panel resource list
> panres at gsnFrame = False ; do not flip the page after calling gsn_panel
> ...
> gsn_panel(wks,plot,(/6,3/),panres)
>
> gres = True
> gres at YPosPercent = 15. ; expressed as %, 0->100, sets position of top border of legend
> ; when gres at Position is set to its default setting of "Top" (Default = 95.)
> gres at XPosPercent = 35. ; expressed as %, 0->100, sets position of left border of legend(Default = 5.
> lineres = True
> ...
> textres = True
> ....
> simple_legend_ndc(wks,gres,lineres,textres)
> frame(wks) ; flip the page (/finish the plot)
>
> Note that I set the gres at YPosPercent = 15 which will mean the top of the legend will start at 15% of the way up the page, and gres at XPosPercent = 35 which will result in the legend starting 35% of the way over from the left side of the page. You will likely have to alter these settings a bit.
>
> Hope that helps. In the future, please include ncl-talk on all replies so that others in the future can see the issue resolution.
> Adam
>
>
> On Mon, Jul 30, 2018 at 11:09 AM Toni Klemm <toni-klemm at tamu.edu <mailto:toni-klemm at tamu.edu>> wrote:
> Hi Adam,
>
> That worked! It plotted the legend, and without any graph because I commented that out. How do I get it to appear in my matrix plot, in the bottom center? I attached that plot for reference. Originally I assigned the legend "plot(16)" because plot 16 would be the bottom center. But that’s when I got the error message. “plot” is an graphics array with 18 elements ("plot = new(18,graphic)”) Is that the problem?
>
> Thank you again,
> Toni
>
>
> Toni Klemm, Ph.D.
> Postdoctoral Research Associate
> Department of Ecosystem Science and Management
> Texas A&M University, College Station, TX
> Contributor at the Early Career Climate Forum <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.eccforum.org&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=vZDXoNZVh-FHQeBimjUETu1oZnRy5LXMitrIB6z2EeY&s=uuJLFqTkjxdif_aJ0nFmcD7xTUrwa7ywQvg4LInDJmM&e=>
> www.toni-klemm.de <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.toni-2Dklemm.de&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=vZDXoNZVh-FHQeBimjUETu1oZnRy5LXMitrIB6z2EeY&s=U0Y5rnows5YR473sgGxk8P53CHZkxTXOzoMSI46sPgI&e=> | @toniklemm <https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_toniklemm&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=vZDXoNZVh-FHQeBimjUETu1oZnRy5LXMitrIB6z2EeY&s=aWwtxR_l1qBEhQb4TrnxEXWIOddjAahWNAUxcVHnUgo&e=>
>
>
>
>
>> On Jul 30, 2018, at 11:52 AM, Adam Phillips <asphilli at ucar.edu <mailto:asphilli at ucar.edu>> wrote:
>>
>> Hi Toni,
>> I think you're loading it correctly. Note though that simple_legend_ndc is a procedure, so nothing is returned from the procedure to the calling script.
>> Try changing this:
>> plot(16) = simple_legend_ndc(wks,gres,lineres,textres)
>> to this:
>> simple_legend_ndc(wks,gres,lineres,textres)
>>
>> Adam
>>
>> On Mon, Jul 30, 2018 at 10:46 AM Toni Klemm <toni-klemm at tamu.edu <mailto:toni-klemm at tamu.edu>> wrote:
>> Hi Alex, thanks again!
>>
>> Unfortunately I’m still getting the error. I saved the function to my server space and loaded it at the beginning of the script like this:
>>
>> load "~/NIFA/NCL_6.5.0_functions/simple_legend_ndc.ncl”
>>
>> The command to execute it in the script looks like this (I used gres, lineres, and textres from the example to test it):
>>
>> plot(16) = simple_legend_ndc(wks,gres,lineres,textres)
>>
>> I also tried this:
>>
>> plot(16) = simple_legend_ndc.ncl(wks,gres,lineres,textres)
>>
>> but got the same error.
>>
>> This is the error I’m getting:
>>
>> fatal:syntax error: line 510 in file matrix_chart_NPP_percentage_all_zones_all_groups.ncl before or near simple_legend_ndc
>> plot(16) = simple_legend_ndc
>> -----------------------------^
>>
>> Am I loading the function correctly? I’m not getting an error about it, so I assume it is loading correctly.
>>
>> Thanks again,
>> Toni
>>
>>
>> Toni Klemm, Ph.D.
>> Postdoctoral Research Associate
>> Department of Ecosystem Science and Management
>> Texas A&M University, College Station, TX
>> Contributor at the Early Career Climate Forum <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.eccforum.org&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=OCrz0F80P765WcmE1_9SOXWuUkltz4e82DSP0ufoLI4&s=C2brqs0P8JS044Qhu-m82ayNzyBbc2MpmxfprvHLvoc&e=>
>> www.toni-klemm.de <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.toni-2Dklemm.de&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=OCrz0F80P765WcmE1_9SOXWuUkltz4e82DSP0ufoLI4&s=TYOC59ftTJQY1ImeUty7VwI_9hWYG7ERiUNyzAAKcts&e=> | @toniklemm <https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_toniklemm&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=OCrz0F80P765WcmE1_9SOXWuUkltz4e82DSP0ufoLI4&s=zQ1pM6aCfNyE08W1HkO8qwH86INpW5B6TBlVk7EJGV0&e=>
>>
>>
>>
>>
>>
>>> On Jul 30, 2018, at 10:53 AM, Adam Phillips <asphilli at ucar.edu <mailto:asphilli at ucar.edu>> wrote:
>>>
>>> Hi Toni,
>>> I think all that you need to do is to load the simple_legend_ndc function (attached to my email from last week) at the top of your script (similar to how you load shea_util.ncl for instance), and you should be good to go. It shouldn't matter that you are running 6.4.0..
>>> Best,
>>> Adam
>>>
>>>
>>> I attached the simple_legend_ndc function to my reply last week; you just need to load it at the top of your script along with the other loaded libraries (like shea_util). I've attached it here.
>>>
>>> On Mon, Jul 30, 2018 at 8:45 AM Toni Klemm <toni-klemm at tamu.edu <mailto:toni-klemm at tamu.edu>> wrote:
>>> Hi Adam,
>>>
>>> Thank you for your advice, and apologies for not responding earlier. I tried the simple legend with the load command load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl” at the beginning of the script because we don't have NCL 6.4.0 installed on our server yet. However, it says the function is not known.
>>>
>>> fatal:Undefined identifier: (simple_legend_ndc) is undefined, can't continue
>>>
>>> Do you have any advice?
>>>
>>> Thank you very much again,
>>> Toni
>>>
>>>
>>> Toni Klemm, Ph.D.
>>> Postdoctoral Research Associate
>>> Department of Ecosystem Science and Management
>>> Texas A&M University, College Station, TX
>>> Contributor at the Early Career Climate Forum <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.eccforum.org&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=aupjGPUT6fmZ4kEnhCSyPXMqiaez4nh7TukgY_1pdvk&s=4wAJ_8zCD1BF0Ac_k6HP0uXMfaorLweGtBJ4GF3k-d0&e=>
>>> www.toni-klemm.de <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.toni-2Dklemm.de&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=aupjGPUT6fmZ4kEnhCSyPXMqiaez4nh7TukgY_1pdvk&s=1kxpnXpMMEmtPRrOQU2uzmDKpLuOYNFMJVIG8Sha0JU&e=> | @toniklemm <https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_toniklemm&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=aupjGPUT6fmZ4kEnhCSyPXMqiaez4nh7TukgY_1pdvk&s=kf-sdX-xqbtWPzlqPotMrY9hASfuiPFavVF9B4AoxhA&e=>
>>>
>>>
>>>
>>>
>>>
>>>> On Jul 26, 2018, at 11:21 PM, Adam Phillips <asphilli at ucar.edu <mailto:asphilli at ucar.edu>> wrote:
>>>>
>>>> HI Toni,
>>>> I cannot speak as to your script's behavior, but I can strongly recommend using simple_legend_ndc to draw a legend (or legends) in NDC space, and simple_legend for drawing a legend within a plot.
>>>> https://www.ncl.ucar.edu/Document/Functions/Shea_util/simple_legend.shtml <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ncl.ucar.edu_Document_Functions_Shea-5Futil_simple-5Flegend.shtml&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=PjQt88ulss5xdSOH64WObRrA7MwSbVCqRGn8xmjbYd4&s=O8PiIXwR3Sv58qiaqm_NYUIaUFwvrxt6JqEHFa9Zkes&e=>
>>>> https://www.ncl.ucar.edu/Document/Functions/Shea_util/simple_legend_ndc.shtml <https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ncl.ucar.edu_Document_Functions_Shea-5Futil_simple-5Flegend-5Fndc.shtml&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=PjQt88ulss5xdSOH64WObRrA7MwSbVCqRGn8xmjbYd4&s=cW91_0kU0Y6xAmsQYxIBkR48LVu6DYh4EKHbJszS0I0&e=>
>>>>
>>>> The latter function is available with the recent release of NCL (v6.5.0). I have attached the function here.
>>>> Hope that helps!
>>>> Adam
>>>>
>>>> On Wed, Jul 25, 2018 at 6:22 PM Toni Klemm <toni-klemm at tamu.edu <mailto:toni-klemm at tamu.edu>> wrote:
>>>> Howdy!
>>>>
>>>> I forgot the script in my earlier email. Apologies!
>>>>
>>>> I wrote an NCL script to plot 16 XY-plots on a 3x6 matrix. Each plot contains 9 lines, so the legend needs to have 9 elements. Because of this large number I wanted to divide the legend up into 2 “columns” (i.e., 2 matrix cells), 5 elements in the first and 4 in the second. I got everything to work, but unfortunately not the legend. The text is too large and the lines are dashed instead of solid. I tried to change the size of the text, but it didn’t do anything. Could someone help me? Could some other commands overrule the settings for the legends?
>>>>
>>>> Thanks a lot for your help! Below is the script, and attached are the netCDF files in a folder and the matrix plot.
>>>>
>>>> Best,
>>>> Toni
>>>>
>>>>
>>>> Toni Klemm, Ph.D.
>>>> Postdoctoral Research Associate
>>>> Department of Ecosystem Science and Management
>>>> Texas A&M University, College Station, TX
>>>> Contributor at the Early Career Climate Forum <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.eccforum.org&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=PjQt88ulss5xdSOH64WObRrA7MwSbVCqRGn8xmjbYd4&s=MssZgxLxOwM6jS0AJ6lJKCfo4mEgc5Y0fGsI7lUFdpk&e=>
>>>> www.toni-klemm.de <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.toni-2Dklemm.de&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=PjQt88ulss5xdSOH64WObRrA7MwSbVCqRGn8xmjbYd4&s=QsT_sEAyTIhn3HIAbe09cU-1WPRsuQKsJHDV9vytFcw&e=> | @toniklemm <https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_toniklemm&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=PjQt88ulss5xdSOH64WObRrA7MwSbVCqRGn8xmjbYd4&s=vzfSSljhZYxB7WJu-r27eiMVvY51pjchRZ6DD9apMe8&e=>
>>>>
>>>>
>>>> Script:
>>>>
>>>>
>>>> ; ---------------------------------------------------
>>>>
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>>
>>>> ; ---------------------------------------------------
>>>>
>>>> begin
>>>>
>>>> RCP_list = [/"rcp_45","rcp_85"/]
>>>> fs_list = [/"fs","nfs"/]
>>>> model_list = [/"CCSM4","GFDL-ESM2M","HadGEM2-ES365","IPSL-CM5A-LR","MRI-CGCM3"/]
>>>>
>>>> RCP_title = [/"RCP 4.5","RCP 8.5"/]
>>>> fs_title = [/"Fire Suppr. off","Fire Suppr. on"/]
>>>> model_title = [/"CCSM4","GFDL-ESM2M","HadGEM2-ES365","IPSL-CM5A-LR","MRI-CGCM3"/]
>>>>
>>>> do h = 0, ListCount(RCP_list) - 1
>>>>
>>>> do i = 0, ListCount(fs_list) - 1
>>>>
>>>> do j = 0, ListCount(model_list) - 1
>>>>
>>>>
>>>> ; ***********************************************
>>>> ; 1 - READ IN MC2 FILE
>>>> ; ***********************************************
>>>>
>>>> print("")
>>>> print("~/NIFA/MC2/subset_climate_zones/" + RCP_list[h](0) + "/" + fs_list[i](0) + "/" + model_list[j](0))
>>>> print("1 - Read in files")
>>>>
>>>> diri = "~/NIFA/MC2/subset_climate_zones/" + RCP_list[h](0) + "/" + fs_list[i](0) + "/" + model_list[j](0) + "/C_ABOVEGR_GROUPED/"
>>>>
>>>> zone_01_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_01.nc","r")
>>>> zone_02_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_02.nc","r")
>>>> zone_03_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_03.nc","r")
>>>> zone_04_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_04.nc","r")
>>>> zone_05_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_05.nc","r")
>>>> zone_06_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_06.nc","r")
>>>> zone_07_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_07.nc","r")
>>>> zone_08_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_08.nc","r")
>>>> zone_09_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_09.nc","r")
>>>> zone_10_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_10.nc","r")
>>>> zone_11_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_11.nc","r")
>>>> zone_12_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_12.nc","r")
>>>> zone_13_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_13.nc","r")
>>>> zone_14_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_14.nc","r")
>>>> zone_15_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_15.nc","r")
>>>> zone_16_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_grouped_zone_16.nc","r")
>>>>
>>>>
>>>> ; ***********************************************
>>>> ; 2 - CREATE MATRIX PLOT
>>>> ; ***********************************************
>>>>
>>>> print("2 - Create Plot Matrix")
>>>>
>>>> plot = new(18,graphic) ; create 17-plot array
>>>>
>>>> diro = "~/NIFA/MC2/subset_climate_zones/time_series/"
>>>> filo = RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_C_ABOVEGR_percentage_zone_01-16_group_01-09"
>>>>
>>>> wks_type = "png" ; plot file type
>>>> wks_type at wkWidth = 3500 ; width dimension
>>>> wks_type at wkHeight = 3500 ; height dimension
>>>> wks = gsn_open_wks(wks_type, diro + filo)
>>>> gsn_define_colormap(wks,"wgne15") ; define colormap
>>>>
>>>>
>>>> ;*********************************************
>>>> ; PLOT MATRIX PARAMETERS
>>>> ;*********************************************
>>>>
>>>> res = True
>>>> res at trYMinF = 0 ; min y axis value
>>>> res at trYMaxF = 100 ; max y axis value
>>>> res at trXMinF = 2015 ; min y axis value
>>>> res at trXMaxF = 2100 ; max x axis value
>>>> res at tmXBMinorOn = True ; turn off minor tickmarks
>>>> res at tmYLMinorOn = True
>>>> res at tmXTOn = False ; turn off top tickmarks
>>>> res at tmYROn = False ; turn off right tickmarks
>>>> res at tmXTBorderOn = False ; turn off top axis
>>>> res at tmYRBorderOn = False ; turn off right axis
>>>>
>>>> res at tiXAxisString = "Years" ; titles
>>>> res at tiYAxisString = "%"
>>>>
>>>>
>>>> res at tmYLLabelFontHeightF = 0.03 ; set font heights
>>>> res at gsnRightStringFontHeightF = 0.03
>>>> res at tiXAxisFontHeightF = 0.03
>>>> res at tiYAxisFontHeightF = 0.03
>>>>
>>>> res at vpWidthF = .8 ; change aspect ratio
>>>> res at vpHeightF = .4
>>>>
>>>> res at gsnDraw = False ; don't draw or advance the frame
>>>> res at gsnFrame = False
>>>>
>>>> res at xyDashPattern = 0 ; Make curves all solid
>>>> res at xyLineColors := (/"blue","red","orange","black","green","pink","brown","purple","grey"/) ; 9 different colors
>>>> res at xyLineThicknesses = (/10,10,10,10,10,10,10,10,10/) ; make second line thicker
>>>>
>>>> ; res at xyMarkLineMode = "MarkLines" ; Markers *and* lines
>>>> ; res at xyMarkers = (/0,2,4,6,7,8,9,14,15/) ; 9 different markers
>>>> ; res at xyMarkerColors := (/"blue","red","yellow","black","green","pink","brown","purple","grey"/) ; 9 different colors
>>>> ; res at xyMarkerThicknesses = (/10,10,10,10,10,10,10,10,10/) ; make second line thicker
>>>>
>>>>
>>>> ;*********************************************
>>>> ; READ IN PLOT VARIABLES
>>>> ;*********************************************
>>>>
>>>> print("3 - Read in plot variables")
>>>>
>>>> year = zone_01_f->year
>>>>
>>>> units = "%"
>>>>
>>>> data_01 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_02 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_03 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_04 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_05 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_06 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_07 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_08 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_09 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_10 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_11 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_12 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_13 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_14 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_15 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>> data_16 = new((/9,dimsizes(year)/),float) ; data array for 9 variables and 85 years of record (2015-2099)
>>>>
>>>>
>>>> print("3a - Zone 1")
>>>>
>>>> data_01(0,:) = zone_01_f->C_ABOVEGR_C3G_percentage
>>>> data_01(1,:) = zone_01_f->C_ABOVEGR_C3S_percentage
>>>> data_01(2,:) = zone_01_f->C_ABOVEGR_C4G_percentage
>>>> data_01(3,:) = zone_01_f->C_ABOVEGR_C4S_percentage
>>>> data_01(4,:) = zone_01_f->C_ABOVEGR_OTHER_percentage
>>>> data_01(5,:) = zone_01_f->C_ABOVEGR_SF_percentage
>>>> data_01(6,:) = zone_01_f->C_ABOVEGR_SW_percentage
>>>> data_01(7,:) = zone_01_f->C_ABOVEGR_TF_percentage
>>>> data_01(8,:) = zone_01_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_01 = zone_01_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 2")
>>>>
>>>> data_02(0,:) = zone_02_f->C_ABOVEGR_C3G_percentage
>>>> data_02(1,:) = zone_02_f->C_ABOVEGR_C3S_percentage
>>>> data_02(2,:) = zone_02_f->C_ABOVEGR_C4G_percentage
>>>> data_02(3,:) = zone_02_f->C_ABOVEGR_C4S_percentage
>>>> data_02(4,:) = zone_02_f->C_ABOVEGR_OTHER_percentage
>>>> data_02(5,:) = zone_02_f->C_ABOVEGR_SF_percentage
>>>> data_02(6,:) = zone_02_f->C_ABOVEGR_SW_percentage
>>>> data_02(7,:) = zone_02_f->C_ABOVEGR_TF_percentage
>>>> data_02(8,:) = zone_02_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_02 = zone_02_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 3")
>>>>
>>>> data_03(0,:) = zone_03_f->C_ABOVEGR_C3G_percentage
>>>> data_03(1,:) = zone_03_f->C_ABOVEGR_C3S_percentage
>>>> data_03(2,:) = zone_03_f->C_ABOVEGR_C4G_percentage
>>>> data_03(3,:) = zone_03_f->C_ABOVEGR_C4S_percentage
>>>> data_03(4,:) = zone_03_f->C_ABOVEGR_OTHER_percentage
>>>> data_03(5,:) = zone_03_f->C_ABOVEGR_SF_percentage
>>>> data_03(6,:) = zone_03_f->C_ABOVEGR_SW_percentage
>>>> data_03(7,:) = zone_03_f->C_ABOVEGR_TF_percentage
>>>> data_03(8,:) = zone_03_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_03 = zone_03_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 4")
>>>>
>>>> data_04(0,:) = zone_04_f->C_ABOVEGR_C3G_percentage
>>>> data_04(1,:) = zone_04_f->C_ABOVEGR_C3S_percentage
>>>> data_04(2,:) = zone_04_f->C_ABOVEGR_C4G_percentage
>>>> data_04(3,:) = zone_04_f->C_ABOVEGR_C4S_percentage
>>>> data_04(4,:) = zone_04_f->C_ABOVEGR_OTHER_percentage
>>>> data_04(5,:) = zone_04_f->C_ABOVEGR_SF_percentage
>>>> data_04(6,:) = zone_04_f->C_ABOVEGR_SW_percentage
>>>> data_04(7,:) = zone_04_f->C_ABOVEGR_TF_percentage
>>>> data_04(8,:) = zone_04_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_04 = zone_04_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 5")
>>>>
>>>> data_05(0,:) = zone_05_f->C_ABOVEGR_C3G_percentage
>>>> data_05(1,:) = zone_05_f->C_ABOVEGR_C3S_percentage
>>>> data_05(2,:) = zone_05_f->C_ABOVEGR_C4G_percentage
>>>> data_05(3,:) = zone_05_f->C_ABOVEGR_C4S_percentage
>>>> data_05(4,:) = zone_05_f->C_ABOVEGR_OTHER_percentage
>>>> data_05(5,:) = zone_05_f->C_ABOVEGR_SF_percentage
>>>> data_05(6,:) = zone_05_f->C_ABOVEGR_SW_percentage
>>>> data_05(7,:) = zone_05_f->C_ABOVEGR_TF_percentage
>>>> data_05(8,:) = zone_05_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_05 = zone_05_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 6")
>>>>
>>>> data_06(0,:) = zone_06_f->C_ABOVEGR_C3G_percentage
>>>> data_06(1,:) = zone_06_f->C_ABOVEGR_C3S_percentage
>>>> data_06(2,:) = zone_06_f->C_ABOVEGR_C4G_percentage
>>>> data_06(3,:) = zone_06_f->C_ABOVEGR_C4S_percentage
>>>> data_06(4,:) = zone_06_f->C_ABOVEGR_OTHER_percentage
>>>> data_06(5,:) = zone_06_f->C_ABOVEGR_SF_percentage
>>>> data_06(6,:) = zone_06_f->C_ABOVEGR_SW_percentage
>>>> data_06(7,:) = zone_06_f->C_ABOVEGR_TF_percentage
>>>> data_06(8,:) = zone_06_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_06 = zone_06_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 7")
>>>>
>>>> data_07(0,:) = zone_07_f->C_ABOVEGR_C3G_percentage
>>>> data_07(1,:) = zone_07_f->C_ABOVEGR_C3S_percentage
>>>> data_07(2,:) = zone_07_f->C_ABOVEGR_C4G_percentage
>>>> data_07(3,:) = zone_07_f->C_ABOVEGR_C4S_percentage
>>>> data_07(4,:) = zone_07_f->C_ABOVEGR_OTHER_percentage
>>>> data_07(5,:) = zone_07_f->C_ABOVEGR_SF_percentage
>>>> data_07(6,:) = zone_07_f->C_ABOVEGR_SW_percentage
>>>> data_07(7,:) = zone_07_f->C_ABOVEGR_TF_percentage
>>>> data_07(8,:) = zone_07_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_07 = zone_07_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 8")
>>>>
>>>> data_08(0,:) = zone_08_f->C_ABOVEGR_C3G_percentage
>>>> data_08(1,:) = zone_08_f->C_ABOVEGR_C3S_percentage
>>>> data_08(2,:) = zone_08_f->C_ABOVEGR_C4G_percentage
>>>> data_08(3,:) = zone_08_f->C_ABOVEGR_C4S_percentage
>>>> data_08(4,:) = zone_08_f->C_ABOVEGR_OTHER_percentage
>>>> data_08(5,:) = zone_08_f->C_ABOVEGR_SF_percentage
>>>> data_08(6,:) = zone_08_f->C_ABOVEGR_SW_percentage
>>>> data_08(7,:) = zone_08_f->C_ABOVEGR_TF_percentage
>>>> data_08(8,:) = zone_08_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_08 = zone_08_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 9")
>>>>
>>>> data_09(0,:) = zone_09_f->C_ABOVEGR_C3G_percentage
>>>> data_09(1,:) = zone_09_f->C_ABOVEGR_C3S_percentage
>>>> data_09(2,:) = zone_09_f->C_ABOVEGR_C4G_percentage
>>>> data_09(3,:) = zone_09_f->C_ABOVEGR_C4S_percentage
>>>> data_09(4,:) = zone_09_f->C_ABOVEGR_OTHER_percentage
>>>> data_09(5,:) = zone_09_f->C_ABOVEGR_SF_percentage
>>>> data_09(6,:) = zone_09_f->C_ABOVEGR_SW_percentage
>>>> data_09(7,:) = zone_09_f->C_ABOVEGR_TF_percentage
>>>> data_09(8,:) = zone_09_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_09 = zone_09_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 10")
>>>>
>>>> data_10(0,:) = zone_10_f->C_ABOVEGR_C3G_percentage
>>>> data_10(1,:) = zone_10_f->C_ABOVEGR_C3S_percentage
>>>> data_10(2,:) = zone_10_f->C_ABOVEGR_C4G_percentage
>>>> data_10(3,:) = zone_10_f->C_ABOVEGR_C4S_percentage
>>>> data_10(4,:) = zone_10_f->C_ABOVEGR_OTHER_percentage
>>>> data_10(5,:) = zone_10_f->C_ABOVEGR_SF_percentage
>>>> data_10(6,:) = zone_10_f->C_ABOVEGR_SW_percentage
>>>> data_10(7,:) = zone_10_f->C_ABOVEGR_TF_percentage
>>>> data_10(8,:) = zone_10_f->C_ABOVEGR_TW_percentage
>>>> ALL_data_10 = zone_10_f->C_ABOVEGR_ALL_annual
>>>>
>>>> print("3a - Zone 11")
>>>>
>>>> data_11(0,:) = zone_11_f->C_ABOVEGR_C3G_percentage
>>>> data_11(1,:) = zone_11_f->C_ABOVEGR_C3S_percentage
>>>> data_11(2,:) = zone_11_f->C_ABOVEGR_C4G_percentage
>>>> data_11(3,:) = zone_11_f->C_ABOVEGR_C4S_percentage
>>>> data_11(4,:) = zone_11_f->C_ABOVEGR_OTHER_percentage
>>>> data_11(5,:) = zone_11_f->C_ABOVEGR_SF_percentage
>>>> data_11(6,:) = zone_11_f->C_ABOVEGR_SW_percentage
>>>> data_11(7,:) = zone_11_f->C_ABOVEGR_TF_percentage
>
>
> --
> Adam Phillips
> Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/ <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cgd.ucar.edu_staff_asphilli_&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=vZDXoNZVh-FHQeBimjUETu1oZnRy5LXMitrIB6z2EeY&s=jjYmT90-TWZr4qX-9tQEBEg5tF0n-AwBSSNLWfqHUig&e=> 303-497-1726
>
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cgd.ucar.edu_staff_asphilli&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=vZDXoNZVh-FHQeBimjUETu1oZnRy5LXMitrIB6z2EeY&s=5phDQ4S4OLBV3sE4I0rx31Dk0N-H8alxsj9qdHa_8Vs&e=><Screen Shot 2018-07-30 at 11.59.19 AM.png><Screen Shot 2018-07-30 at 11.59.19 AM.png>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180730/9ca876d0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2018-07-30 at 1.45.15 PM.png
Type: image/png
Size: 527920 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180730/9ca876d0/attachment-0001.png>
More information about the ncl-talk
mailing list