close

How to hide axes and gridlines in Matplotlib (python)

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to hide axes and gridlines in Matplotlib (python) in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to hide axes and gridlines in Matplotlib (python)?

  1. How to hide axes and gridlines in Matplotlib (python)?

    Turn the axes off with:
    plt.axis('off')
    And gridlines with:
    plt.grid(b=None)

  2. hide axes and gridlines in Matplotlib (python)

    Turn the axes off with:
    plt.axis('off')
    And gridlines with:
    plt.grid(b=None)

Method 1

# Hide grid lines
ax.grid(False)

# Hide axes ticks
ax.set_xticks([])
ax.set_yticks([])
ax.set_zticks([])

Note, you need matplotlib>=1.2 for set_zticks() to work.

Method 2

Turn the axes off with:

plt.axis('off')

And gridlines with:

plt.grid(b=None)

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read