BUG: matplotlib is supposed to be optional

This code was failing to find matplotlib and
the first import was silently continuing, but
then the second call that requires matplotlib
began failing.