[ncl-talk] Issue with creating a bar chart plot

Andrew Kren - NOAA Affiliate andrew.kren at noaa.gov
Sun Jun 7 18:57:15 MDT 2020


I looked into these things. My x_axis is simply created this way:

x_axis = ispan(4,73,3)


And the printed values are correct, increasing by 3 starting at 4, 7, etc.


So this is still kinda confusing as to why.

On Sun, Jun 7, 2020 at 5:41 PM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:

> It is only the horizontal axis that needs to be monotonically increasing.
> That is probably what the error message is about.  Naturally, the vertical
> access may fluctuate anywhere.  You might want to check the values of
> x_axis in your code to see if they make sense.
>
> Meanwhile, you should be able to insert a quick fix for x_axis with
> temporary arrays, something like this.  This assumes that x_axis is
> strictly decreasing rather than increasing.  If you change the order, then
> you must also change the order for the vertical axis data, in the same
> way.  X and Y values are supposed to form ordered pairs to make the bar
> chart.
>
> xplot = x_axis(::-1)
> yplot = tolong (temperature_top(i,23:0:-1))
> plot = gsn_csm_xy (wks, xplot, yplot, res)
>
> I have no idea what changed to cause a newer NCL version to change from
> the original behavior.
>
>
> On Sun, Jun 7, 2020 at 1:57 PM Andrew Kren - NOAA Affiliate via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Dear ncl-talk,
>>
>> I upgraded my NCL to the latest version. Previously I was using version
>> 6.5. When I upgraded, one of my ncl codes no longer runs successfully but
>> creates an error code. I am creating a bar chart with gsn_csm_xy. I
>> originally did not get these errors so I am unsure what could be going on.
>> I tried to debug the issue but to no avail. Here are my errors:
>>
>> (0) get_bar_widths: Warning: The bar width(s) you selected (0.75) is
>> larger than the smallest delta (-11).
>>
>> (0) Defaulting to -11.
>>
>> (0) get_bar_arrays: Fatal: The array is not monotonically increasing.
>>
>> (0) Cannot draw a bar chart.
>>
>> fatal:Illegal right-hand side type for assignment
>>
>>
>> I checked that my array I am plotting has all correct values, and it
>> does. I didn't know a bar chart had to have monotonically increasing
>> values. Is there a way around this?
>>
>>
>> The code where it fails is below, in the call to plot.
>>
>>
>> plot = gsn_csm_xy(wks,x_axis,tolong(temperature_top(i,0:23)),res)
>>
>> Thanks,
>>
>> --
>> Andrew Kren
>> Meteorologist
>> US Dept of Commerce
>> National Oceanic and Atmospheric Administration
>> National Weather Service Raleigh, NC
>> 1005 Capability Drive, Suite 300
>> Centennial Campus
>> Raleigh, NC 27606-5226
>>
>

-- 
Andrew Kren
Meteorologist
US Dept of Commerce
National Oceanic and Atmospheric Administration
National Weather Service Raleigh, NC
1005 Capability Drive, Suite 300
Centennial Campus
Raleigh, NC 27606-5226
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200607/e523ef83/attachment.html>


More information about the ncl-talk mailing list