Changed matplotlib exception handling for when graphics are not available.