Using matplotlib to visualize images