now saves directly as png file instead of copying device output to png file. fixes cut off legend text