Sunday, 7 January 2018

python 2.7 - Plotting “large” image with points with matplotlib - MemoryError


I want to plot an image of 3193 x 3293 pixels with 1502 points. When running in a smaller image and less points (934,722 pixels and 60 points), everything runs perfectly.


I wrote like this:


# I am just giving the general characteristics of the data;    
img = numpy.ndarray, dtype = uint8, shape = (3193,3293)

points = numpy.ndarray, dtype = int32, shape = (1502,2)

plt.imshow(img, cmap=plt.cm.gray_r)
plt.autoscale(False)
plt.plot(points[:, 1], points[:, 0], 'r.', markersize = 15)
plt.axis('off')
plt.show()

Is there any other way to do this without using that much memory?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...