Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

change tick labelsize matplotlib

import matplotlib.pyplot as plt
# We prepare the plot  
fig, ax = plt.subplots()

# We change the fontsize of minor ticks label 
ax.tick_params(axis='both', which='major', labelsize=10)
ax.tick_params(axis='both', which='minor', labelsize=8)
Comment

Matplotlib vertical tick labels

import matplotlib.pyplot as plt

x = range(6)
y = [-3, -2, -1, 1, 2, 3]
xlabels = [f'label {i}' for i in x]

fig, ax = plt.subplots()
ax.bar(x, y)

# ha='***' is not enough to visually align labels with ticks 
# use both ha='***' and rotation_mode='anchor'
ax.set_xticks(x, xlabels, rotation=45, ha='right', rotation_mode='anchor')

plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: count number of islands python 
Python :: Create MySQL table from Python 
Python :: how to create dataframe in python 
Python :: pandas insert column in the beginning 
Python :: python get date file last modified 
Python :: How to get random int between two numbers python 
Python :: set axis title matplotlib 
Python :: install mamba conda 
Python :: python format 2 digits 
Python :: numpy mean 2 arrays 
Python :: python 2 decimal places 
Python :: each line in a text file into a list in Python 
Python :: clibboard to png 
Python :: select closest number in array python 
Python :: panda select rows where column value inferior to 
Python :: isprime function in python 
Python :: install a specific version of django 
Python :: python alphabet 
Python :: favicon django 
Python :: flask install 
Python :: how to clear console in python 
Python :: python find files recursive 
Python :: pandas convert to 2 digits decimal 
Python :: python get file extension from path 
Python :: n random numbers python 
Python :: string with comma to int python 
Python :: django python base 64 encode 
Python :: save matplotlib figure with base64 
Python :: panda get rows with date range 
Python :: exclude columns pandas 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =