1

Hello I have this code using matplotlib :

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1],[1])
ax.tick_params(axis=u'both', which=u'both', length=0)
plt.show()

enter image description here

But I would like to have this :

enter image description here

I mean I just want to remove the black border.

It it possible ?

Thank you very much !

Peter
  • 49
  • 1
  • 5
  • 1
    Read https://stackoverflow.com/questions/14908576/how-to-remove-frame-from-matplotlib-pyplot-figure-vs-matplotlib-figure-frame – zjb Jul 12 '20 at 11:30

1 Answers1

1

use ax.spines["top"].set_visible(False) to control visibility of boarders

import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot([1],[1])
ax.tick_params(axis=u'both', which=u'both', length=0)

ax.spines["top"].set_visible(False)
ax.spines["right"].set_visible(False)
ax.spines["bottom"].set_visible(False)
ax.spines["left"].set_visible(False)
plt.show()

output

enter image description here

Adhun Thalekkara
  • 713
  • 10
  • 23