cis
cis copied to clipboard
Error plotting empty timeseries
When plotting a time-series with all the data-points masked matplotlib throws an error about the date conversion:
...
File "/Users/watson-parris/miniconda3/envs/cis_env3/lib/python3.7/site-packages/cis/plotting/plot.py", line 126, in format_datetime
date_time = num2date(x)
File "/Users/watson-parris/miniconda3/envs/cis_env3/lib/python3.7/site-packages/matplotlib/dates.py", line 522, in num2date
return _from_ordinalf(x, tz)
File "/Users/watson-parris/miniconda3/envs/cis_env3/lib/python3.7/site-packages/matplotlib/dates.py", line 321, in _from_ordinalf
'expects datetime objects.'.format(ix))
ValueError: Cannot convert -1 to a date. This often happens if non-datetime values are passed to an axis that expects datetime objects.
CIS should catch this and produce an informative error when trying to plot empty datasets.