[ncl-talk] Problem creating pie-chart

juhee yi yjuhee09 at gmail.com
Wed Aug 26 19:20:02 MDT 2015


Hi everyone,

I'm trying to create a pie-chart, but getting the following error message:

-- error message
----------------------------------------------------------------------------

fatal:fspan: number of elements parameter is less-than-or-equal-to one,
can't continue

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 4026 in
file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl


fatal:["Execute.c":8575]:Execute: Error occurred at or near line 43 in file
2_2.ncl

------------------------------------------------------------------------------------------------------

I think, this error occurred because of percent value less then 0.5

Below is my script
-- coding
-----------------------------------------------------------------------------------------

;*********************************************************

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 "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

;*********************************************************

begin



  input = "/home/yjh/AERONET/Data/EMAC_modeling_data/"

  output = "/home/yjh/AERONET/Coding/EMAC_modeling/pie_chart/"


;****************** pie chart
***********************************************************


  pcRes = True

  pcRes at gsnDraw = False

  pcRes at gsnFrame = False


  name  = (/ "BAOT", "DAOT", "HAOT", "OAOT", "SAOT", "WAOT" /)

  color = (/ "red", "green", "orange", "yellow","magenta","blue"/)


  wks   = gsn_open_wks("ps",output+"result/Baengnyeong_pie_chart")

  panel = new (4, "graphic")


;************************************************

; create panel using "block" labels [user specified]

;************************************************


  pcRes at pcLabelType     = "block"


  pcRes at tiMainString    = "Winter"

  percent  = (/0.6, 8.0, 68.7, 1.4, 1.7, 19.6/)

  panel(0) = pie_chart(wks, percent, name, color, pcRes)


  pcRes at tiMainString    = "Spring"

  percent  = (/0.9, 17.6, 53.8, 2.8, 0.7, 24.2/)

  panel(1) = pie_chart(wks, percent, name, color, pcRes)


  pcRes at tiMainString    = "Summer"

  percent  = (/1.2, 8.3, 66.8, 3.6, 0.4, 19.7/)

  panel(2) = pie_chart(wks, percent, name, color, pcRes)


  pcRes at tiMainString    = "Autumn"

  percent  = (/1.1, 14.9, 55.6, 2.7, 1.2, 24.5/)

  panel(3) = pie_chart(wks, percent, name, color, pcRes)


  resP                  = True                    ; resources for panel plot


  resP at gsnDraw          = True  ;False

  resP at gsnFrame         = True  ;False

  resP at gsnMaximize      = True

  resP at gsnPaperMargin   = 0.1


  resP at txString         = "EMAC data [2000-2010] ratio : Baengnyeong
[38.0N,124.6E]"


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

;**************************************************************************************************

end

**********************************************************************************************************


Thanks for any help you could give me.


-----------------------------------------------------------------------

JuHee Yi  |  Master's Course

Chungnam National University

Daejeon, South Korea

-----------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150827/b8a4a330/attachment.html 


More information about the ncl-talk mailing list