[ncl-talk] Error trying to make a simple pie chart
Michele Petrini - CITG
M.Petrini at tudelft.nl
Tue Sep 1 08:45:16 MDT 2020
Dear helpdesk,
I am contacting you as I am trying to make a simple pie chart and there is something strange happening;
when I run this code
color=(/"lightskyblue","brown1"/)
name=(/"Accumulation","Ablation"/)
percent=(/10.0,90.0/)
pcRes = True
pcRes at gsnMaximize = True
pcRes at tiMainString = areas(i)+": average years "+ystartavg+"-"+yendavg ; Sector Label is default
piechart = pie_chart(wks2, percent, name, color, pcRes)
I get the following error:
fatal:Number of subscripts do not match number of dimensions of variable,(2) Subscripts used, (1) Subscripts expected
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 4172 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl
I went to look at line 4172 in shea_util.ncl and what I’m reading is
—
4172 pgRes at gsFillColor = colors(n,:) ; fill with associated color
4173 plotPC@$unique_string("dum")$ = gsn_add_polygon (wks, plotPC, xx, yy, pgRes) ; color fill
4174 plotPC@$unique_string("dum")$ = gsn_add_polyline(wks, plotPC, xx, yy, plRes) ; outline
4175
4176 gsRes at gsMarkerColor = colors(n,:) ; associate marker
—
If I replace colors(n,:) with colors(n) in the lines above, the script does work fine.
I am still wondering whether there is something wrong in my code - although I am using the very same code as in pie_chart_2.ncl (https://www.ncl.ucar.edu/Applications/Scripts/pie_chart_2.ncl) - or there is a bug in shea_util.ncl.
Thanks!
Michele
******************************************************************
Michele Petrini, PhD
Department of Geoscience and Remote Sensing, TUDelft
Delft, The Netherlands
M.Petrini at tudelft.nl<mailto:M.Petrini at tudelft.nl>
+39 3398367372
michele.petrins (Skype alias)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200901/4b2f265b/attachment.html>
More information about the ncl-talk
mailing list