matplotlib complains when trying to generate a plot_years plot on a DataArray with a size-1 named dimension and using it as the "show" parameter.
To reproduce the error:
from agrifoodpy.food.food import FoodElementSheet
import xarray as xr
import numpy as np
da_1 = xr.DataArray(np.random.rand(5,1),
coords=[('Year', [2010, 2011, 2012, 2013, 2014]),
('Region', ['A'])],
dims=['Year', 'Region'])
fbs_1 = FoodElementSheet(da_1)
fbs_1.plot_years(show="Region")
I tried using da.squeeze() to remove size-1 named dimension and it does seems to fix the issue.
matplotlib complains when trying to generate a
plot_yearsplot on a DataArray with a size-1 named dimension and using it as the "show" parameter.To reproduce the error:
I tried using da.squeeze() to remove size-1 named dimension and it does seems to fix the issue.