1

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

johndmalcolm
  • 65
  • 2
  • 8

1 Answers1

3

Matplotlib plots: removing axis, legends and white spaces

Use mpimg.axis('off')

See also the matplotlib documentation:

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

Community
  • 1
  • 1
Caius
  • 243
  • 1
  • 5
  • Sorry, I don't mean the axes, but the border that is traced around the pencil. ax.axis('off') does not remove this. – johndmalcolm Jul 29 '16 at 17:27
  • 1
    Could you post the source picture and the result of saving it with axis off but no rotation applied? – Caius Jul 29 '16 at 17:39