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

  • Home
  • SEARCH
  • 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 8523987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:33:52+00:00 2026-06-11T07:33:52+00:00

The numbers on the x-axis disappear when turning on log scale. import numpy as

  • 0

The numbers on the x-axis disappear when turning on “log” scale.

import numpy as np
import matplotlib.pyplot as plt

plt.plot( range(1,10) , range(1,10) ,  color='#aaaaff')
plt.xscale('log')
plt.xticks(range(1,10) )
plt.show()

If I comment out xscale the numbers on the x-axis are printed. Can someone shed light on why this does not work on log scale axis and how this can be achieved?

Edit:

Simplified code, so that it can be used without the data file. Same thing: No numbers!!

  • 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-06-11T07:33:53+00:00Added an answer on June 11, 2026 at 7:33 am

    By default tick locations for log axes are in base 10. So in the above case the only possible xtick is at 1.

    If you change the xticks to

    plt.xticks([1,10])
    

    you get ticks at 1 and 10.

    You can also play with ticker which allows you to do many stuff. E.g.,

    import numpy as np
    import matplotlib.pyplot as plt
    from matplotlib.ticker import LogLocator
    
    fig = plt.figure(1, [5,4])
    ax = fig.add_subplot(111)
    
    ax.plot( range(1,100) , range(1,100) ,  color='#aaaaff')
    ax.set_xscale('log')
    # This is default, so play with it
    ax.xaxis.set_major_locator(LogLocator(base = 10.0))
    plt.show()
    

    enter image description here

    If you use:

    ax.xaxis.set_major_locator(LogLocator(base = 100.0))
    

    then you get

    enter image description here

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

Sidebar

Related Questions

I've created a simple hexbin plot with matplotlib.pyplot. I haven't changed any default settings.
This is my code: %cirkel t=linspace(0,2*pi); r1=2; x1=r1.*cos(t); y1=r1.*sin(t); cirkel=plot(x1,y1); set(cirkel,'color','g') axis equal hold
When I try to do a plot against a range with big enough numbers
The page is http://matplotlib.sourceforge.net/examples/pylab_examples/histogram_demo_extended.html Let's look at the y-axis, the numbers there do not
I have several different numbers in a group that range in sizes and would
Possible Duplicate: How to choose the numbers shown on the axes of a plot
I am using really big numbers (milions) on my x-axis, so when I use
I have a list (intensityList) with 1354 numbers. they range from 25941.9 to 1639980000.0,
A simple XY line graph: The X axis will represent the complete range of
I am trying to conditionally format the numbers that appear in a NumericAxis axis

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.