[python] How can I change the font size of ticks of axes object in matplotlib

I have a figure I added subfigure to (inset). I have used:

fig = plt.figure()
ax = fig.add_subplot(111)
subA = fig.add_axes([0.4,0.14,0.2,0.2])

I now want to change the xtick font size of the subfigure. I tried some naive approach such as

subA.get_xaxis().get_xticks().set_fontsize(10)

without any luck.

How can I do this then?

This question is related to python matplotlib axis subplot

The answer is


Use:

subA.tick_params(labelsize=6)

fig = plt.figure()
ax = fig.add_subplot(111)
plt.xticks([0.4,0.14,0.2,0.2], fontsize = 50) # work on current fig
plt.show()

the x/yticks has the same properties as matplotlib.text


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to matplotlib

"UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure." when plotting figure with pyplot on Pycharm How to increase image size of pandas.DataFrame.plot in jupyter notebook? How to create a stacked bar chart for my DataFrame using seaborn? How to display multiple images in one figure correctly? Edit seaborn legend How to hide axes and gridlines in Matplotlib (python) How to set x axis values in matplotlib python? How to specify legend position in matplotlib in graph coordinates Python "TypeError: unhashable type: 'slice'" for encoding categorical data Seaborn Barplot - Displaying Values

Examples related to axis

R barplot Y-axis scale too short How can I change the font size of ticks of axes object in matplotlib Multiple contexts with the same path error running web service in Eclipse using Tomcat Please initialize the log4j system properly. While running web service Secondary axis with twinx(): how to add to legend? Content is not allowed in Prolog SAXParserException Python, Matplotlib, subplot: How to set the axis range? rotating axis labels in R Difference between Apache CXF and Axis How to add custom Http Header for C# Web Service Client consuming Axis 1.4 Web service

Examples related to subplot

How do I get multiple subplots in matplotlib? Python: subplot within a loop: first panel appears in wrong position Matplotlib 2 Subplots, 1 Colorbar How can I change the font size of ticks of axes object in matplotlib Matplotlib - global legend and title aside subplots pyplot axes labels for subplots