johndmalcolm
johndmalcolm

Reputation: 65

How to rotate image with Matplottlib without border?

I have an image with a white background that I would like to rotate. The rotation, however, creates an unwanted border around the image (not the axes, but the grey outline around the pencil below). How can I remove this border?

fig,ax = plt.subplots(figsize=(8,6))

pencil = mpimg.imread('Pencil.jpg')
pencil = ndimage.rotate(pencil,105)
ax.imshow(pencil,aspect='equal')

enter image description here

Upvotes: 1

Views: 219

Answers (1)

Caius
Caius

Reputation: 243

Matplotlib plots: removing axis, legends and white spaces

Use mpimg.axis('off')

See also the matplotlib documentation:

http://matplotlib.org/api/axis_api.html

Upvotes: 3

Related Questions