Move matplotlib import inside function.