[ncl-talk] Creating Tercile Hovmoeller Plots in a 4-plot Panel

Toni Klemm toni-klemm at tamu.edu
Wed Sep 26 12:53:46 MDT 2018


All,

This is a resource email I wanted to share with the group on how to create tercile Hovmoeller plots in a panel of 4 plots with a legend. I have used this to visualize some of our research results. The idea to show numerical data in a way similar to the tercile probability forecasts from the NWS Climate Prediction Center (however, showing land cover data, not probabilities of exceedance). Big thanks to Adam Phillips and Dennis Shea at UCAR/NCAR for their help!

In my example below, I am displaying projections of land cover percentage of grassland, shrubland, and trees across the U.S. Great Plains from 2015 to 2099. The data for each of the four zones were stored in four different files (“zone_0” … “zone_3”), were percentage values (0-100%) of total land cover for three land cover types I used (grassland, shrubland, trees), and are set up in a 20x85 grid cell array (20 longitudes and 85 years) for each zone. The latitudinal extent of each zone can be different from mine. The landcover percentages of the three variables add up to 100% for each grid cell in each zone. Longitudes are stored in the variable lon_zones as 1D array (list) of numbers, as are the years (2015-2099).

The upside of this way of displaying data is that different land cover types can be displayed in one graph. The downside is that only the dominant type is shown while the other two are not even though they do exist in reality.

Techniques shown:
- Selecting colors for custom color table from an existing color table
- Creating custom color bar/label bar with custom color table and positioning at specific spot on the plot
- Comparing three arrays and determining largest number in every data field
- Creating Hovmoeller plots
- Overlaying several Hovmoeller plots
- Paneling these overlayed Hovmoeller plots and positioning at custom spot on the panel plot

Good luck,
Toni


Toni Klemm, Ph.D.
Postdoctoral Research Associate
Department of Ecosystem Science and Management
College of Agriculture and Life Sciences
Texas A&M University, College Station, TX
Contributor to the Early Career Climate Forum <http://www.eccforum.org/>
www.toni-klemm.de <http://www.toni-klemm.de/> | @toniklemm <http://twitter.com/toniklemm>




; ***********************************************
; NCL example: https://www.ncl.ucar.edu/Applications/panel.shtml -> panel_3.ncl
; These files are loaded by default in NCL V6.2.0 and newer
; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************

begin

RCP_list = [/"rcp_45","rcp_85"/]
fs_list = [/"fs","nfs"/]
model_list = [/"Ens_Avg","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 = [/"Ensemble","CCSM4","GFDL-ESM2M","HadGEM2-ES365","IPSL-CM5A-LR","MRI-CGCM3"/]
zone_title = [/"Entire Great Plains","Northern Great Plains","Central Great Plains","Southern Great Plains"/]

do h = 0, ListCount(RCP_list) - 1 

  do i = 0, ListCount(fs_list) - 1 

    do j = 0, ListCount(model_list) - 1 


;************************************************
; READ IN FILE
;************************************************
 print("")
 print("~/NIFA/MC2/subset_100_M/" + RCP_list[h](0) + "/" + fs_list[i](0) + "/" + model_list[j](0))
 print("1 - Read in files")

 diri = "~/NIFA/MC2/subset_100_M/" + RCP_list[h](0) + "/" + fs_list[i](0) + "/" + model_list[j](0) + "/VTYPE_3_GROUPED/"

  zone_00_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_VTYPE_3_grouped_lat_zone_0_2015-2099_time_series.nc","r")
  zone_01_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_VTYPE_3_grouped_lat_zone_1_2015-2099_time_series.nc","r")
  zone_02_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_VTYPE_3_grouped_lat_zone_2_2015-2099_time_series.nc","r")
  zone_03_f = addfile(diri + RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_VTYPE_3_grouped_lat_zone_3_2015-2099_time_series.nc","r")
  

  ; ***********************************************
  ; 2 - EXTRACT VARIABLES
  ; ***********************************************

  print("2 - Extract variables")

  data_00_G = zone_00_f->G_timeseries           ; _timeseries array has the size (/85,20/)
  data_01_G = zone_01_f->G_timeseries
  data_02_G = zone_02_f->G_timeseries
  data_03_G = zone_03_f->G_timeseries

  data_00_S = zone_00_f->S_timeseries
  data_01_S = zone_01_f->S_timeseries
  data_02_S = zone_02_f->S_timeseries
  data_03_S = zone_03_f->S_timeseries

  data_00_T = zone_00_f->T_timeseries
  data_01_T = zone_01_f->T_timeseries
  data_02_T = zone_02_f->T_timeseries
  data_03_T = zone_03_f->T_timeseries

  data_00_G&lon_zones = zone_00_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)
  data_01_G&lon_zones = zone_01_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)
  data_02_G&lon_zones = zone_02_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)
  data_03_G&lon_zones = zone_03_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)

  data_00_S&lon_zones = zone_00_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)
  data_01_S&lon_zones = zone_01_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)
  data_02_S&lon_zones = zone_02_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)
  data_03_S&lon_zones = zone_03_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)

  data_00_T&lon_zones = zone_00_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)
  data_01_T&lon_zones = zone_01_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)
  data_02_T&lon_zones = zone_02_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)
  data_03_T&lon_zones = zone_03_f->lon_zones    ; needed to set units of lon_zones to get correct "W" labels (degrees West)

  year = zone_00_f->year
  lon_zones = zone_00_f->lon_zones


;************************************************
; create plots
;************************************************

  print("3 - Determine Terciles")            ; Determine for every field in the _timeseries arrays the land cover type with the highest percentage (grassland, shrubland, or trees)

  counter = 1

  do y = 0,84      ; year loop
    do l = 0,19    ; longitude loop(Trees)


; **** Entire Great Plains
  if (ismissing(data_00_G(y,l))) then        ; Missing value (Grassland)
    data_00_G(y,l) = data_00_G at _FillValue
  else
    if (data_00_G(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_00_G(y,l) = 0
    end if
  end if

  if (ismissing(data_00_S(y,l))) then        ; Missing value (Shrubland)
    data_00_S(y,l) = data_00_S at _FillValue
  else
    if (data_00_S(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_00_S(y,l) = 0
    end if
  end if

  if (ismissing(data_00_T(y,l))) then        ; Missing value (Trees)
    data_00_T(y,l) = data_00_T at _FillValue
  else
    if (data_00_T(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_00_T(y,l) = 0
    end if
  end if

  if (data_00_G(y,l) .le. data_00_S(y,l)) then    ; If G =< S --> G = 0
    data_00_G(y,l) = 0
  else
    data_00_S(y,l) = 0                            ; If G > S --> S = 0
  end if

  if (data_00_T(y,l) .le. data_00_S(y,l)) then    ; If T =< S --> T = 0
    data_00_T(y,l) = 0
  else
    data_00_S(y,l) = 0                            ; If T > S --> S = 0
  end if

  if (data_00_G(y,l) .le. data_00_T(y,l)) then    ; If G =< T --> G = 0
    data_00_G(y,l) = 0
  else
    data_00_T(y,l) = 0                            ; If G > T --> T = 0
  end if


; **** Northern Great Plains

  if (ismissing(data_01_G(y,l))) then        ; Missing value (Grassland)
    data_01_G(y,l) = data_01_G at _FillValue
  else
    if (data_01_G(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_01_G(y,l) = 0
    end if
  end if

  if (ismissing(data_01_S(y,l))) then        ; Missing value (Shrubland)
    data_01_S(y,l) = data_01_S at _FillValue
  else
    if (data_01_S(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_01_S(y,l) = 0
    end if
  end if

  if (ismissing(data_01_T(y,l))) then        ; Missing value (Trees)
    data_01_T(y,l) = data_01_T at _FillValue
  else
    if (data_01_T(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_01_T(y,l) = 0
    end if
  end if

  if (data_01_G(y,l) .le. data_01_S(y,l)) then    ; If G =< S --> G = 0
    data_01_G(y,l) = 0
  else
    data_01_S(y,l) = 0                            ; If G > S --> S = 0
  end if

  if (data_01_T(y,l) .le. data_01_S(y,l)) then    ; If T =< S --> T = 0
    data_01_T(y,l) = 0
  else
    data_01_S(y,l) = 0                            ; If T > S --> S = 0
  end if

  if (data_01_G(y,l) .le. data_01_T(y,l)) then    ; If G =< T --> G = 0
    data_01_G(y,l) = 0
  else
    data_01_T(y,l) = 0                            ; If G > T --> T = 0
  end if


; **** Central Great Plains

  if (ismissing(data_02_G(y,l))) then        ; Missing value (Grassland)
    data_02_G(y,l) = data_02_G at _FillValue
  else
    if (data_02_G(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_02_G(y,l) = 0
    end if
  end if

  if (ismissing(data_02_S(y,l))) then        ; Missing value (Shrubland)
    data_02_S(y,l) = data_02_S at _FillValue
  else
    if (data_02_S(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_02_S(y,l) = 0
    end if
  end if

  if (ismissing(data_02_T(y,l))) then        ; Missing value (Trees)
    data_02_T(y,l) = data_02_T at _FillValue
  else
    if (data_02_T(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_02_T(y,l) = 0
    end if
  end if

  if (data_02_G(y,l) .le. data_02_S(y,l)) then    ; If G =< S --> G = 0
    data_02_G(y,l) = 0
  else
    data_02_S(y,l) = 0                            ; If G > S --> S = 0
  end if

  if (data_02_T(y,l) .le. data_02_S(y,l)) then    ; If T =< S --> T = 0
    data_02_T(y,l) = 0
  else
    data_02_S(y,l) = 0                            ; If T > S --> S = 0
  end if

  if (data_02_G(y,l) .le. data_02_T(y,l)) then    ; If G =< T --> G = 0
    data_02_G(y,l) = 0
  else
    data_02_T(y,l) = 0                            ; If G > T --> T = 0
  end if


; **** Southern Great Plains

  if (ismissing(data_03_G(y,l))) then        ; Missing value (Grassland)
    data_03_G(y,l) = data_03_G at _FillValue
  else
    if (data_03_G(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_03_G(y,l) = 0
    end if
  end if

  if (ismissing(data_03_S(y,l))) then        ; Missing value (Shrubland)
    data_03_S(y,l) = data_03_S at _FillValue
  else
    if (data_03_S(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_03_S(y,l) = 0
    end if
  end if

  if (ismissing(data_03_T(y,l))) then        ; Missing value (Trees)
    data_03_T(y,l) = data_03_T at _FillValue
  else
    if (data_03_T(y,l) .le. (100/3)) then    ; 33.3% threshold
      data_03_T(y,l) = 0
    end if
  end if

  if (data_03_G(y,l) .le. data_03_S(y,l)) then    ; If G =< S --> G = 0
    data_03_G(y,l) = 0
  else
    data_03_S(y,l) = 0                            ; If G > S --> S = 0
  end if

  if (data_03_T(y,l) .le. data_03_S(y,l)) then    ; If T =< S --> T = 0
    data_03_T(y,l) = 0
  else
    data_03_S(y,l) = 0                            ; If T > S --> S = 0
  end if

  if (data_03_G(y,l) .le. data_03_T(y,l)) then    ; If G =< T --> G = 0
    data_03_G(y,l) = 0
  else
    data_03_T(y,l) = 0                            ; If G > T --> T = 0
  end if

  end do  ; end longitude loop
end do    ; end year loop


; Now replacing zero values just created with missing values so they have no color in the plot (zero values would be white) and underlying plot shows through

do y = 0,84      ; year loop
  do l = 0,19    ; longitude loop


; zone 0

  if (ismissing(data_00_G(y,l))) then        ; Missing value (Grassland)
    data_00_G(y,l) = data_00_G at _FillValue
  else
    if (data_00_G(y,l) .eq. 0) then          ; 0 -> missing value
      data_00_G(y,l) = data_00_G at _FillValue
    end if
  end if

  if (ismissing(data_00_S(y,l))) then        ; Missing value (Shrubland)
    data_00_S(y,l) = data_00_S at _FillValue
  else
    if (data_00_S(y,l) .le. (100/3)) then    ; 0 -> missing value
      data_00_S(y,l) = data_00_S at _FillValue
    end if
  end if

  if (ismissing(data_00_T(y,l))) then        ; Missing value (Trees)
    data_00_T(y,l) = data_00_T at _FillValue
  else
    if (data_00_T(y,l) .le. (100/3)) then    ; 0 -> missing value
      data_00_T(y,l) = data_00_T at _FillValue
    end if
  end if


; zone 1

  if (ismissing(data_01_G(y,l))) then        ; Missing value (Grassland)
    data_01_G(y,l) = data_01_G at _FillValue
  else
    if (data_01_G(y,l) .eq. 0) then          ; 0 -> missing value
      data_01_G(y,l) = data_01_G at _FillValue
    end if
  end if

  if (ismissing(data_01_S(y,l))) then        ; Missing value (Shrubland)
    data_01_S(y,l) = data_01_S at _FillValue
  else
    if (data_01_S(y,l) .le. (100/3)) then    ; 0 -> missing value
      data_01_S(y,l) = data_01_S at _FillValue
    end if
  end if

  if (ismissing(data_01_T(y,l))) then        ; Missing value (Trees)
    data_01_T(y,l) = data_01_T at _FillValue
  else
    if (data_01_T(y,l) .le. (100/3)) then    ; 0 -> missing value
      data_01_T(y,l) = data_01_T at _FillValue
    end if
  end if


; zone 2

  if (ismissing(data_02_G(y,l))) then        ; Missing value (Grassland)
    data_02_G(y,l) = data_02_G at _FillValue
  else
    if (data_02_G(y,l) .eq. 0) then          ; 0 -> missing value
      data_02_G(y,l) = data_02_G at _FillValue
    end if
  end if

  if (ismissing(data_02_S(y,l))) then        ; Missing value (Shrubland)
    data_02_S(y,l) = data_02_S at _FillValue
  else
    if (data_02_S(y,l) .le. (100/3)) then    ; 0 -> missing value
      data_02_S(y,l) = data_02_S at _FillValue
    end if
  end if

  if (ismissing(data_02_T(y,l))) then        ; Missing value (Trees)
    data_02_T(y,l) = data_02_T at _FillValue
  else
    if (data_02_T(y,l) .le. (100/3)) then    ; 0 -> missing value
      data_02_T(y,l) = data_02_T at _FillValue
    end if
  end if


; zone 3

  if (ismissing(data_03_G(y,l))) then        ; Missing value (Grassland)
    data_03_G(y,l) = data_03_G at _FillValue
  else
    if (data_03_G(y,l) .eq. 0) then          ; 0 -> missing value
      data_03_G(y,l) = data_03_G at _FillValue
    end if
  end if

  if (ismissing(data_03_S(y,l))) then        ; Missing value (Shrubland)
    data_03_S(y,l) = data_03_S at _FillValue
  else
    if (data_03_S(y,l) .le. (100/3)) then    ; 0 -> missing value
      data_03_S(y,l) = data_03_S at _FillValue
    end if
  end if

  if (ismissing(data_03_T(y,l))) then        ; Missing value (Trees)
    data_03_T(y,l) = data_03_T at _FillValue
  else
    if (data_03_T(y,l) .le. (100/3)) then    ; 0 -> missing value
      data_03_T(y,l) = data_03_T at _FillValue
    end if
  end if

  end do  ; end longitude loop
end do    ; end year loop


;************************************************
; 4 - CREATE COLORS
;************************************************

  print("4 - Create colors")

; Define colors for the plots, also needed for the custom color bars
  ncolors    = 9
  lblabels   = (/"30","40","50","60","70","80","90","100 %"/)  ; color bar labels text

  color_254  = ispan(0,254,28)                        ; "WhiteGreen" and "WhiteBlue", every 28th shade from 254 -> 9 total
  color_128  = ispan(0,128,14)                        ; "MPL_Greys", every 14th shade from 128 -> 9 total

  colors_grass  = new((/ncolors,4/),float)           ; color array for grassland (colors are triplets of 4 numbers per shade, thus 4 as the second dimension)
  colors_shrubs = new((/ncolors,4/),float)           ; shrubland
  colors_trees  = new((/ncolors,4/),float)           ; trees

  cmap_grass    = read_colormap_file("WhiteGreen”)   ; color for grassland
  cmap_shrubs   = read_colormap_file("MPL_Greys")    ; ... shrubland
  cmap_trees    = read_colormap_file("WhiteBlue")    ; ... trees

  do n = 0,(ncolors-1)
    colors_grass(n,:)  = cmap_grass(color_254(n),:)  ; pick the respective colors for the grassland plots
    colors_shrubs(n,:) = cmap_shrubs(color_128(n),:) ; ... shubland plots
    colors_trees(n,:)  = cmap_trees(color_254(n),:)  ; ... tree plots
  end do


;************************************************
; 5 - CREATE PANEL PLOT COMPONENTS
;************************************************

  print("5 - Create Plot Matrix")

  plot  = new(4,graphic)                     ; 4 main plots
  oplot = new((/4,2/),graphic)               ; will contain 2 overlay plots for 4 panels
  
  diro  = "~/NIFA/MC2/subset_100_M/time_series/VTYPE/3_groups_HOV_terciles/"
  filo  = RCP_list[h](0) + "_" + fs_list[i](0) + "_" + model_list[j](0) + "_VTYPE_percentage_HOV_3_groups_GST_terciles_zone_0-3"

  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)

  res                      = True
  res at gsnDraw              = False           ; don't draw
  res at gsnFrame             = False           ; don't advance frame
  res at cnInfoLabelOn        = False           ; turn off cn info label
  res at cnConstFLabelOn      = False           ; show note "CONSTANT FIELD - VALUE IS 0" if all values are missing
  res at cnNoDataLabelOn      = False           ; show note "NO CONTOUR DATA"
  res at trYMinF              = 2015            ; min  y axis value
  res at trYMaxF              = 2100            ; max  y axis value
  res at cnFillMode           = "RasterFill"    ; Raster Mode, plots raster grid, not contour lines
  res at cnFillOn             = True            ; turn on color
  res at cnLinesOn            = False           ; contour lines of the map fill on or off  
  res at lbLabelBarOn         = False           ; turn on individual color bars
  res at trXMinF              = -105            ; min y axis value
  res at trXMaxF              = -95             ; max x axis value
  res at tmXBMode             = "Explicit"
  res at tmXBValues           = ispan(-105,-95,1)
  res at tmXBLabels           = (/"105W","","103W","","101W","","99W","","97W","","95W"/)
  res at cnLineLabelsOn       = False
  res at cnLevelSelectionMode = "ManualLevels"
  res at cnMinLevelValF       = 30
  res at cnMaxLevelValF       = 100
  res at cnLevelSpacingF      = 10 
  res at gsnLeftString        = ""              ; blank left string, otherwise would be metadata information from file
    
; Grassland plots
  res at cnFillPalette    = colors_grass                   ; color scheme for Grassland percentage
  res at gsnRightString   = "Entire Great Plains"          ; title
  plot(0)              = gsn_csm_hov(wks,data_00_G,res)
    res at gsnRightString = "Northern Great Plains"        ; title
  plot(1)              = gsn_csm_hov(wks,data_01_G,res)
    res at gsnRightString = "Central Great Plains"         ; title
  plot(2)              = gsn_csm_hov(wks,data_02_G,res)
    res at gsnRightString = "Southern Great Plains"        ; title
  plot(3)              = gsn_csm_hov(wks,data_03_G,res)

; Shrubland plots
  res at cnFillPalette    = colors_shrubs                  ; color scheme for Shrubland percentage
  res at gsnRightString   = "Entire Great Plains"          ; title
  oplot(0,0)           = gsn_csm_hov(wks,data_00_S,res)
    res at gsnRightString = "Northern Great Plains"        ; title
  oplot(1,0)           = gsn_csm_hov(wks,data_01_S,res)
    res at gsnRightString = "Central Great Plains"         ; title
  oplot(2,0)           = gsn_csm_hov(wks,data_02_S,res)
    res at gsnRightString = "Southern Great Plains"        ; title
  oplot(3,0)           = gsn_csm_hov(wks,data_03_S,res)

; Treeland plots
  res at cnFillPalette    = colors_trees                   ; color scheme for Treeland percentage
  res at gsnRightString   = "Entire Great Plains"          ; title
  oplot(0,1)           = gsn_csm_hov(wks,data_00_T,res)
    res at gsnRightString = "Northern Great Plains"        ; title
  oplot(1,1)           = gsn_csm_hov(wks,data_01_T,res)
    res at gsnRightString = "Central Great Plains"         ; title
  oplot(2,1)           = gsn_csm_hov(wks,data_02_T,res)
    res at gsnRightString = "Southern Great Plains"        ; title
  oplot(3,1)           = gsn_csm_hov(wks,data_03_T,res)

; Overlay procedure, overlay each grassland plots first with shrubland and then tree plots from same zone
  do gg = 0,3
    overlay(plot(gg),oplot(gg,0))    
    overlay(plot(gg),oplot(gg,1))
  end do

;*************************************************
; ADD CUSTOM LABEL BARS
;************************************************* 

; 1) Grassland label bar

  lbres                        = True
  lbres at lbPerimOn              = False               ; no label bar box
  lbres at lbOrientation          = "Horizontal"        ; orientation
  lbres at vpWidthF               = 0.3                 ; size
  lbres at vpHeightF              = 0.05
  lbres at lbLabelFontHeightF     = 0.008               ; label font height
  lbres at lbLabelAlignment       = "InteriorEdges"     ; where to label
  lbres at lbMonoFillPattern      = True                ; fill sold
  lbres at lbFillColors           = colors_grass        ; must be RGB triplets
  lbres at lbTitleString          = "Grassland"         ; label bar title
  
  gsn_labelbar_ndc(wks,ncolors,lblabels,0.21,0.58,lbres)

; 1) Shrubland label bar

  lbres                        = True
  lbres at lbPerimOn              = False                ; no label bar box
  lbres at lbOrientation          = "Horizontal"        ; orientation
  lbres at vpWidthF               = 0.3                 ; size
  lbres at vpHeightF              = 0.05
  lbres at lbLabelFontHeightF     = 0.008               ; label font height
  lbres at lbLabelAlignment       = "InteriorEdges"     ; where to label
  lbres at lbMonoFillPattern      = True                ; fill sold
  lbres at lbFillColors           = colors_shrubs        ; must be RGB triplets
  lbres at lbTitleString          = "Shrubland"          ; label bar title
  
  gsn_labelbar_ndc(wks,ncolors,lblabels,0.21,0.5,lbres)

; 1) Treeland label bar

  lbres                        = True
  lbres at lbPerimOn              = False                ; no label bar box
  lbres at lbOrientation          = "Horizontal"        ; orientation
  lbres at vpWidthF               = 0.3                 ; size
  lbres at vpHeightF              = 0.05
  lbres at lbLabelFontHeightF     = 0.008               ; label font height
  lbres at lbLabelAlignment       = "InteriorEdges"     ; where to label
  lbres at lbMonoFillPattern      = True                ; fill sold
  lbres at lbFillColors           = colors_trees        ; must be RGB triplets
  lbres at lbTitleString          = "Trees"          ; label bar title
  
  gsn_labelbar_ndc(wks,ncolors,lblabels,0.21,0.42,lbres)
 

;************************************************
; CREATE PANEL
;************************************************

  resP                             = True                 ; modify the panel plot
  resP at gsnPanelXWhiteSpacePercent  = 0                    ; horizontal white space between columns in percent
  resP at gsnPanelYWhiteSpacePercent  = 5                    ; vertical white space between rows in percent
  resP at gsnPanelMainString          = RCP_title[h](0) + " | " + fs_title[i](0) + " | " + model_title[j](0) + " | Potential Vegetation Coverage"
  resP at tiMainFontHeightF           = 0.03
  resP at tiMainFont                  = 21
  resP at cnInfoLabelOn               = False                ; turn off cn info label
  resP at gsnPanelLabelBar            = False                ; add common colorbar
  resP at lbLabelFontHeightF          = 0.007                ; make labels smaller
  resP at gsnPanelRowSpec             = True
  resP at gsnPanelXF                  = (/-1,0.6,0.6,0.6/)   ; left-right position of panel plots
  resP at tiXAxisString               = "Longitude" ; titles
  resP at tiYAxisString               = "Year"

  gsn_panel(wks,plot,(/2,1,1/),resP)                      ; now draw as one plot

  delete([/wks,res,resP,diro,filo,wks/])

  delete([/zone_00_f,zone_01_f,zone_02_f,zone_03_f,diri,data_00_G,data_01_G,data_02_G,data_03_G,data_00_S,data_01_S,data_02_S,data_03_S,data_00_T,data_01_T,data_02_T,data_03_T/])

  print("**** DONE ****")
  print("")


      end do ; end model list loop

    end do ; end fs list loop

  end do ; end RCP list loop

  print("**** ALL DONE ****")

end




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180926/f93b9872/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rcp_45_fs_Ens_Avg_VTYPE_percentage_HOV_3_groups_GST_terciles_zone_0-3.png
Type: image/png
Size: 312151 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180926/f93b9872/attachment-0001.png>


More information about the ncl-talk mailing list