Fixing legend size problem by plotting directly to png device and avoiding dev.copy.