only import matplotlib if needed