Add check for matplotlib existence