Tomas
Tomas

Reputation: 533

Turn off Matplotlib imshow interpolation when saved as PDF

Is there a way to turn off the interpolation of Matplotlib's imshow function when saved as PDF?

EDIT

Running the following code:

import numpy as np
import matplotlib.pyplot as plt
image = np.random.random((200,200))
plt.imshow(image, interpolation='nearest')
plt.savefig('image.pdf')

will create a PDF that looks like:

enter image description here

Zooming in will reveal that the 'pixels' are interpolated:

enter image description here

Is there a way to turn the interpolation off? I am using Matplotlib 2.0.2 and Python 2.7.13.

Thanks!

Upvotes: 1

Views: 1862

Answers (1)

csl
csl

Reputation: 11358

I had the same problem and was able to it by using interpolation=None.

Upvotes: 2

Related Questions