Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Set axis ticks matplotlib

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker

x = [0,5,9,10,15]
y = [0,1,2,3,4]
fig, ax = plt.subplots()
ax.plot(x,y)
start, end = ax.get_xlim()
ax.set_xticks(np.arange(start, end, 2))
plt.show()
Comment

increase axis ticks pyplot

x = [0,5,9,10,16]
y = [0,1,2,3,5]

x_ticks = np.arange(0, 16, 5)
plt.xticks(x_ticks)

y_ticks = np.arange(0, 5, 2)
plt.yticks(y_ticks)

plt.plot(x, y)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas save dataframe to csv in python 
Python :: c++ vs python 
Python :: reset_index(drop=true) 
Python :: flask cookies 
Python :: random 0 or 1 python 
Python :: cheat sheet python 
Python :: bucketizer pyspark 
Python :: python random randint string 
Python :: how to concat on the basis of particular columns in pandas 
Python :: algorithms for Determine the sum of al digits of n 
Python :: how to use label encoding in python 
Python :: Convert two lists into a dictionary in python 
Python :: Python Requests Library Patch Method 
Python :: variable in python 
Python :: python sort the values in a dictionary 
Python :: start project django 
Python :: merge dicts python 
Python :: pyplot python 
Python :: bold some letters of string in python 
Python :: Simple dictionary in Python 
Python :: python json web request 
Python :: open csv from url python 
Python :: dijkstras python 
Python :: dir() in python 
Python :: word embedding python 
Python :: how to add percentage in countplot 
Python :: Support Vector Machine (SVM) classifier 
Python :: pandas xa0 
Python :: import ImageGrab 
Python :: round list python 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =