Make matplotlib dependency optional.