Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plt.xticks

# Show x axes with intervals of X instead of default (this case default=5)
import numpy as np
import matplotlib.pyplot as plt

x = [0,5,9,10,15]
y = [0,1,2,3,4]
X = 1.0
plt.plot(x,y)
plt.xticks(np.arange(min(x), max(x)+1, X))
plt.show()
Comment

plt.yticks(

# import the libraries
import numpy as np
from matplotlib import pyplot as plt

# create the data values to plot the graph
x = np.array([1, 2, 3, 4, 5, 6])
y = np.array(2 * x + 2)
z = np.array(2 * y + 1)
yticks = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50]
Y = 5

# plot the graph using matplotlib

plt.title('Line graph for the equation y=2x+2')
plt.xlabel('X_axis')
plt.ylabel('Y_axis')
plt.plot(x, y, linewidth=2, color='red', marker='.', markersize=7)
plt.yticks(np.arange(min(yticks), max(yticks) + 1, Y))
plt.grid()
plt.show()
Comment

xticks label matplotlib

ax.set_xticks(np.arange(len(data)))
ax.set_xticklabels(labels)
Comment

xticks and yticks matplotlib

#x-ticks: 
plt.xticks(start, stop, step))
#y-ticks:
plt.yticks(np.arange(start,stop,step))
Comment

yticks matplotlib

locs, labels = yticks()  # Get the current locations and labels.
>>> yticks(np.arange(0, 1, step=0.2))  # Set label locations.
>>> yticks(np.arange(3), ['Tom', 'Dick', 'Sue'])  # Set text labels.
>>> yticks([0, 1, 2], ['January', 'February', 'March'],
...        rotation=45)  # Set text labels and properties.
>>> yticks([])  # Disable yticks.
Comment

PREVIOUS NEXT
Code Example
Python :: tuple with one element python 
Python :: how to output random letters in python 
Python :: flask redirect to url 
Python :: screen size python 
Python :: how to make it so we can give unlimited parameters in python function 
Python :: python sqlite dict 
Python :: python solve equation with two variables 
Python :: python gaussian elimination 
Python :: py how to deactivate venv 
Python :: django create token for user 
Python :: python hello world web application 
Python :: im save to a bytes io python 
Python :: How to install XGBoost package in python using conda 
Python :: how to read a text file from url in python 
Python :: django link home page 
Python :: Flatten List in Python Using List Comprehension 
Python :: python list of integers 
Python :: value_count pandas change column name 
Python :: how to smooth a function in python 
Python :: add dir to path python 
Python :: how to check nth prime in python 
Python :: input array of string in python 
Python :: sklearn train_test_split 
Python :: python list comprehension if else 
Python :: getting multiple selected value django 
Python :: get first x characters of string python 
Python :: pandas dataframe column names 
Python :: python get directory of current script file 
Python :: python input 
Python :: django file upload this field is required 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =