Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plt hide axis ticks

 pythonCopyimport matplotlib.pyplot as plt

plt.plot([0, 10], [0, 10])
plt.xlabel("X Label")
plt.ylabel("Y Label")

ax = plt.gca()
ax.axes.xaxis.set_visible(False)
ax.axes.yaxis.set_visible(False)

plt.grid(True)
plt.show()
Comment

how to hide ticks marks in plot

import matplotlib.pyplot as plt
import numpy as np

# Simple data to display in various forms
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x ** 2)

fig, axarr = plt.subplots(2, 2)
fig.suptitle("This Main Title is Nicely Formatted", fontsize=16)

axarr[0, 0].plot(x, y)
axarr[0, 0].set_title('Axis [0,0] Subtitle')
axarr[0, 1].scatter(x, y)
axarr[0, 1].set_title('Axis [0,1] Subtitle')
axarr[1, 0].plot(x, y ** 2)
axarr[1, 0].set_title('Axis [1,0] Subtitle')
axarr[1, 1].scatter(x, y ** 2)
axarr[1, 1].set_title('Axis [1,1] Subtitle')

# Fine-tune figure;
# hide x ticks for top plots and y ticks for right plots

plt.setp([a.get_xticklabels() for a in axarr[0, :]], visible=False)
plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False)


# Tight layout often produces nice results
# but requires the title to be spaced accordingly

fig.tight_layout()
fig.subplots_adjust(top=0.88)

plt.show()


Comment

PREVIOUS NEXT
Code Example
Python :: iterating index array python 
Python :: check type of variable in python 
Python :: spanish to english 
Python :: python txt to parquet 
Python :: python switch columns order csv 
Python :: list comprehension python one line 
Python :: code for merge sort 
Python :: how to use for loop to take n number of input in python 
Python :: convex hull python 
Python :: delete and start fresh with db django 
Python :: tuple index in python 
Python :: calculate quartil python 
Python :: python random select no replace 
Python :: matplotlib draw line x1, y1 
Python :: power of array 
Python :: skimage local threshold 
Python :: python subset 
Python :: matplotlib list backend 
Python :: how to automatically install python packages 
Python :: purpose of meta class in django 
Python :: pygame surface 
Python :: remove from list if not maches in list 
Python :: IQR to remove outlier 
Python :: text from xml doc in python 
Python :: NumPy unique Example Get unique values from a 1D Numpy array 
Python :: group by month and day pandas 
Python :: datetime column only extract date pandas 
Python :: swap 2 no in one line python 
Python :: zip a directory in python 
Python :: models in django 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =