fix: matplotlib import to inside function