Switch matplotlib renders if error, use Agg as fallback