Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6055337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:15:13+00:00 2026-05-23T08:15:13+00:00

In a matplotlib figure, how can I make the font size for the tick

  • 0

In a matplotlib figure, how can I make the font size for the tick labels using ax1.set_xticklabels() smaller?

Further, how can one rotate it from horizontal to vertical?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:15:14+00:00Added an answer on May 23, 2026 at 8:15 am

    Please note that newer versions of MPL have a shortcut for this task. An example is shown in the other answer to this question: https://stackoverflow.com/a/11386056/42346

    The code below is for illustrative purposes and may not necessarily be optimized.

    import matplotlib.pyplot as plt
    import numpy as np
    
    def xticklabels_example():
        fig = plt.figure() 
    
        x = np.arange(20)
        y1 = np.cos(x)
        y2 = (x**2)
        y3 = (x**3)
        yn = (y1,y2,y3)
        COLORS = ('b','g','k')
    
        for i,y in enumerate(yn):
            ax = fig.add_subplot(len(yn),1,i+1)
    
            ax.plot(x, y, ls='solid', color=COLORS[i]) 
    
            if i != len(yn) - 1:
                # all but last 
                ax.set_xticklabels( () )
            else:
                for tick in ax.xaxis.get_major_ticks():
                    tick.label.set_fontsize(14) 
                    # specify integer or one of preset strings, e.g.
                    #tick.label.set_fontsize('x-small') 
                    tick.label.set_rotation('vertical')
    
        fig.suptitle('Matplotlib xticklabels Example')
        plt.show()
    
    if __name__ == '__main__':
        xticklabels_example()
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say that I have two figures in matplotlib, with one plot per figure: import
I am using matplotlib and numpy to make a polar plot. Here is some
I created a 3D plot using matplotlib as this: fig = pylab.figure() ax =
I've been playing around with Matplotlib and I can't figure out how to change
Is there a way to save a Matplotlib figure such that it can be
There are many matplotlib colorbar questions on stack overflow, but I can't make sense
I'm trying to make a point and figure chart . I can get it
I have a class that has an output() method which returns a matplotlib Figure
I am using matplotlib in a django app and would like to directly return
I am working on using Matplotlib to produce plots of implicit equations (eg. y^x=x^y).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.