Amir Rosenfeld
Amir Rosenfeld

Reputation: 371

Default behavior of matplotlib imshow()

In matplotlib, when using imshow(), the default behavior is to display the image with bilinear interpolation.

I know I can change this explicitly by calling imshow(...,interpolation='none'). But this is cumbersome for many calls to imshow.

How do I change the default behavior, to e.g, interpolation='none'?

Upvotes: 1

Views: 365

Answers (1)

Amir Rosenfeld
Amir Rosenfeld

Reputation: 371

Found it! Apparently, there's a dictionary controlling many aspects of matplotlib, called rcParams. Straight from the matplotlib docs:

import matplotlib as mpl
mpl.rcParams['lines.linewidth'] = 2
mpl.rcParams['lines.color'] = 'r'

In my case, I had to set:

rcParams['image.interpolation']='none'

Upvotes: 1

Related Questions