;************************************************* ; example program for Box-Percentile-Plots ; ; based on: Esty WW, Banfield J: The box-percentile plot. J Statistical Software 8 No. 17, 2003. ; ;************************************************ 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 "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl" load "Box_Percentile_Plot.ncl" ;************************************************ begin ; program ;************************************************ ;************************************************ ; create plot wtype = "png" wtype@wkWidth = 1200 ; Set the pixel size of image. wtype@wkHeight = 1000 ; Set the pixel size of image. wks = gsn_open_wks(wtype,"Test-2Achsen") i_res = True i_res@tmXBLabels = (/"RCP2.6","RCP8.5","","RCP2.6","RCP8.5"/) i_res@tmXBLabelFontHeightF = 0.02 i_res@tmXBLabelAngleF = 90 i_res@tmXBLabelJust = "CenterCenter" i_res@tmYMajorGrid = True ; implement y grid i_res@tmYMajorGridLineDashPattern = 2 ; select short dash lines i_res@trYMinF = 0 ;-90 i_res@trYMaxF = 6 ; 90 i_res@tiMainFontHeightF = 0.023 i_res@tiMainString = ""; "tas_year (Deutschland)" i_res@tmXTBorderOn = True i_res@tmYRBorderOn = True i_res@tmYUseLeft = True i_res@vpXF = 0.15 i_res@vpYF = 0.9 i_res@vpWidthF = 0.85 i_res@vpHeightF = 0.65 i_res@tiYAxisString = "" i_res@tiXAxisString = "2021-2050 2071-2100" i_res@tiXAxisFontHeightF = 0.03 i_boxOpts = True i_boxOpts@boxColors = "blue" ;(/"blue","blue"/) i_boxOpts@boxWidth = 0.3 ; with DNA == True 0.3 / without 0.4 i_lineRes = True i_lineRes@gsLineThicknessF = 0.9 i_lineRes@txFontHeightF = 5 i_lineRes@tmXBLabelFontHeightF = 9 i_markerRes = True i_markerRes@gsMarkerIndex = 1 i_markerRes@gsMarkerSizeF = 0.05 i_markerRes@gsMarkerThicknessF = 1 i_markerRes@gsMarkerColor = "black"; (/"red","blue"/) ;"blue" i_PerRes = True i_PerRes@gsLineColor = (/"seagreen","royalblue","white","seagreen","royalblue"/) ;"black"; (/"blue","red"/) ;"blue" i_PerRes@gsLineThicknessF = 5 i_PerRes@boxColors = "blue" ; (/"blue","red"/) ;i_PerRes@gsFillColor = (/"green","blue","white","green","blue"/) ; i_PerRes@gsFillColor = (/"seagreen","royalblue","white","seagreen","royalblue"/) ; ;i_PerRes@gsFillColor = (/"gray75","gray43","white","gray75","gray43"/) ; i_PerRes@FillBox = True ;(/True,False/) i_PerRes@MarkPer = True ;(/True,True/) i_PerRes@Avg = True ;(/True,True/) i_DNA = True ;True i_DNA@gsLineColor = "black";(/ "green","green","green","green","green","green","green","green","green","green","green","green","green","green","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","black","green"/) i_DNA@gsLineThicknessF = 6.0 i_NoMember = False ; False ;True i_NoMember@txFontHeightF = 0.015 i_NoMember@txJust = "BottomLeft" data = new((/5,022/),float) data@_FillValue = -999. data(0,:) = (/ -999.0, 0.9, 1.4, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, 1.0, -999.0, 1.7, 0.8, 0.8, 1.1, -999.0, 1.5, 1.1, -999.0, -999.0, 0.9, 0.8/) data(1,:) = (/ 1.5, 1.4, 1.8, 2.1, 0.8, 1.4, 1.3, 1.9, 1.9, 1.6, 1.3, 2.0, 0.7, 1.1, 1.6, 1.4, 1.8, 1.0, 1.4, 1.6, 0.8, -999.0/) data(2,:) = (/ -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0/) data(3,:) = (/ -999.0, 1.0, 1.5, -999.0, -999.0, -999.0, -999.0, -999.0, -999.0, 1.2, -999.0, 1.8, 0.8, 1.0, 1.2, -999.0, 1.6, 0.9, -999.0, -999.0, 1.0, 0.6/) data(4,:) = (/ 4.7, 3.5, 4.4, 5.2, 2.8, 3.9, 3.5, 4.4, 4.8, 3.8, 3.6, 5.0, 2.7, 2.9, 3.8, 3.9, 4.6, 3.3, 3.4, 4.1, 2.8, -999.0/) i_FormRaute = False box = box_percentile_plot( wks,data, i_res,i_boxOpts,i_lineRes,i_markerRes,i_PerRes,i_DNA,i_NoMember,i_FormRaute) ; ;Test hinzufügen 2. Achse res2 = True res2@gsnFrame = False res2@tmYUseLeft = False res2@tmYROn = True res2@tmYRLabelsOn = True res2@tmXBOn = False res2@tmXBLabelsOn = False ;... ; other tm resources may be needed. res2@trYMinF = 0.6 res2@trYMaxF = 6.6 res2@tmYLMode = "Explicit" res2@vpXF = 0.15 res2@vpYF = 0.9 res2@vpWidthF = 0.85 res2@vpHeightF = 0.65 bplot = gsn_csm_blank_plot(wks,res2) ; txres = True gsres = True txres@txFontHeightF = 0.025 txres@txAngleF = 90 ; derotate text txres@txJust = "CenterCenter" Auml = "A~H-15V6F35~H~FV-6H3~" gsn_text_ndc(wks,"Anomaly to 1971-2000 [~S~o~N~C]",0.03,0.55,txres) txres@txFontHeightF = 0.025 ;gsn_text_ndc(wks,"",0.1,0.200,txres) txres@txAngleF = 00 ; derotate text txres@txFontHeightF = 0.01 amres1 = True amres1@amJust = "BottomRight" amres1@amParallelPosF = 0.5 ; This is the right edge of the plot. amres1@amOrthogonalPosF = -0.5 ; This is the bottom edge of the plot. ; txid0 = gsn_create_text(wks,"preliminary results, no warranty (creation date: 04.12.2015)", txres) ; annoid1 = gsn_add_annotation(box, txid0, amres1) txres@txAngleF = 0 ; derotate text txres@txFontHeightF = 0.013 txres@txFontColor = "black" txres@txJust = "CenterCenter" ; gsn_text_ndc(wks,"(EUR11)",0.1,0.12,txres) txres@txFontColor = "green" txres@txJust = "CenterCenter" ; gsn_text_ndc(wks,"(EUR44)",0.1,0.1,txres) ;************************************************ ; Drawing plot draw(box) frame(wks) ;************************************************ end ; program ;************************************************