[ncl-talk] Dividing a legend over 2 cells in a matrix plot
Adam Phillips
asphilli at ucar.edu
Thu Jul 26 22:21:58 MDT 2018
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://www.ncl.ucar.edu/Document/Functions/Shea_util/simple_legend_ndc.shtml
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> 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 <http://www.eccforum.org>
> www.toni-klemm.de | @toniklemm <http://twitter.com/toniklemm>
>
>
> *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
> data_11(8,:) = zone_11_f->C_ABOVEGR_TW_percentage
> ALL_data_11 = zone_11_f->C_ABOVEGR_ALL_annual
>
> print("3a - Zone 12")
>
> data_12(0,:) = zone_12_f->C_ABOVEGR_C3G_percentage
> data_12(1,:) = zone_12_f->C_ABOVEGR_C3S_percentage
> data_12(2,:) = zone_12_f->C_ABOVEGR_C4G_percentage
> data_12(3,:) = zone_12_f->C_ABOVEGR_C4S_percentage
> data_12(4,:) = zone_12_f->C_ABOVEGR_OTHER_percentage
> data_12(5,:) = zone_12_f->C_ABOVEGR_SF_percentage
> data_12(6,:) = zone_12_f->C_ABOVEGR_SW_percentage
> data_12(7,:) = zone_12_f->C_ABOVEGR_TF_percentage
> data_12(8,:) = zone_12_f->C_ABOVEGR_TW_percentage
> ALL_data_12 = zone_12_f->C_ABOVEGR_ALL_annual
>
> print("3a - Zone 13")
>
> data_13(0,:) = zone_13_f->C_ABOVEGR_C3G_percentage
> data_13(1,:) = zone_13_f->C_ABOVEGR_C3S_percentage
> data_13(2,:) = zone_13_f->C_ABOVEGR_C4G_percentage
> data_13(3,:) = zone_13_f->C_ABOVEGR_C4S_percentage
> data_13(4,:) = zone_13_f->C_ABOVEGR_OTHER_percentage
> data_13(5,:) = zone_13_f->C_ABOVEGR_SF_percentage
> data_13(6,:) = zone_13_f->C_ABOVEGR_SW_percentage
> data_13(7,:) = zone_13_f->C_ABOVEGR_TF_percentage
> data_13(8,:) = zone_13_f->C_ABOVEGR_TW_percentage
> ALL_data_13 = zone_13_f->C_ABOVEGR_ALL_annual
>
> print("3a - Zone 14")
>
> data_14(0,:) = zone_14_f->C_ABOVEGR_C3G_percentage
> data_14(1,:) = zone_14_f->C_ABOVEGR_C3S_percentage
> data_14(2,:) = zone_14_f->C_ABOVEGR_C4G_percentage
> data_14(3,:) = zone_14_f->C_ABOVEGR_C4S_percentage
> data_14(4,:) = zone_14_f->C_ABOVEGR_OTHER_percentage
> data_14(5,:) = zone_14_f->C_ABOVEGR_SF_percentage
> data_14(6,:) = zone_14_f->C_ABOVEGR_SW_percentage
> data_14(7,:) = zone_14_f->C_ABOVEGR_TF_percentage
> data_14(8,:) = zone_14_f->C_ABOVEGR_TW_percentage
> ALL_data_14 = zone_14_f->C_ABOVEGR_ALL_annual
>
> print("3a - Zone 15")
>
> data_15(0,:) = zone_15_f->C_ABOVEGR_C3G_percentage
> data_15(1,:) = zone_15_f->C_ABOVEGR_C3S_percentage
> data_15(2,:) = zone_15_f->C_ABOVEGR_C4G_percentage
> data_15(3,:) = zone_15_f->C_ABOVEGR_C4S_percentage
> data_15(4,:) = zone_15_f->C_ABOVEGR_OTHER_percentage
> data_15(5,:) = zone_15_f->C_ABOVEGR_SF_percentage
> data_15(6,:) = zone_15_f->C_ABOVEGR_SW_percentage
> data_15(7,:) = zone_15_f->C_ABOVEGR_TF_percentage
> data_15(8,:) = zone_15_f->C_ABOVEGR_TW_percentage
> ALL_data_15 = zone_15_f->C_ABOVEGR_ALL_annual
>
> print("3a - Zone 16")
>
> data_16(0,:) = zone_16_f->C_ABOVEGR_C3G_percentage
> data_16(1,:) = zone_16_f->C_ABOVEGR_C3S_percentage
> data_16(2,:) = zone_16_f->C_ABOVEGR_C4G_percentage
> data_16(3,:) = zone_16_f->C_ABOVEGR_C4S_percentage
> data_16(4,:) = zone_16_f->C_ABOVEGR_OTHER_percentage
> data_16(5,:) = zone_16_f->C_ABOVEGR_SF_percentage
> data_16(6,:) = zone_16_f->C_ABOVEGR_SW_percentage
> data_16(7,:) = zone_16_f->C_ABOVEGR_TF_percentage
> data_16(8,:) = zone_16_f->C_ABOVEGR_TW_percentage
> ALL_data_16 = zone_16_f->C_ABOVEGR_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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> 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" ;
> printed on the top right
> plot(15) = gsn_csm_xy (wks,year,data_16,res) ; create plot
>
> ;***********************************************
> ; CREATING A LEGEND
> ;***********************************************
>
> print("5 - Create legend")
> ; var_long_name = (/"C3 grassland","C3 shrubland","C4 grassland","C4
> shrubland","Other","Subtropical forest","Subtropical woodland","Temperate
> forest","Temperate woodland"/)
>
> 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 = False
> 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
>
> delete(lgres)
>
> ; Legend elements 6-9
> 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,4,var_long_name_02,lgres) ;
> create legend
>
> /;
> amres = True
> amres at amParallelPosF = 0 ; move legend to the right
> amres at amOrthogonalPosF = 0 ; move the legend down
> annoid1 = gsn_add_annotation(plot(16),lbid,amres) ; add legend to plot
> ;/
>
> ;***********************************************
> ; panel plots together
> ;***********************************************
>
> print("6 - Create plot matrix")
>
> ; print((/decimalPlaces(min(data),0,True)/))
> ; print((/decimalPlaces(max(data),0,True)/))
>
> 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) + " | Above ground C 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,0.6/)
>
> 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,lgres/])
>
> sleep(10)
> end do ; end model list loop
>
> end do ; end fs list loop
>
> end do ; end RCP list loop
>
> print("**** ALL DONE ****")
>
> end
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180726/e271d8ac/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simple_legend_ndc.ncl
Type: application/octet-stream
Size: 5497 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180726/e271d8ac/attachment.obj>
More information about the ncl-talk
mailing list