Home > Blockchain >  matplotlib: How to turn off figure box without Lines?
matplotlib: How to turn off figure box without Lines?

Time:06-25

I am visualization multi-time series lines and want to show without axis. I have tried multiple solutions from google but could not successful.

Here is the code:

f = plt.figure(frameon=False)
f.set_figwidth(4)
f.set_figheight(1)
plt.plot(x, linewidth=1.5)

Here is the output of the above code:

enter image description here

Any idea how to turn off this box from the lines?

CodePudding user response:

for spine in plt.gca().spines.values():
    spine.set_visible(False)
    
ax = plt.gca()
ax.axes.xaxis.set_visible(False)
ax.axes.yaxis.set_visible(False)

CodePudding user response:

Finally I fixed the code via getting help from enter image description here

CodePudding user response:

Not a hundred percent sure what you mean by 'axis', but you can get rid of the frame by setting this:

plt.box(False)

enter image description here

So this is how it looks like:

  • Related