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 6939505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:37:53+00:00 2026-05-27T12:37:53+00:00

I have a histogram with only a few values. As a result, the x

  • 0

I have a histogram with only a few values. As a result, the x axis ticks are decimals:

enter image description here

How can I make it 1,2,3,4,5?

  • 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-27T12:37:53+00:00Added an answer on May 27, 2026 at 12:37 pm

    You can use matplotlib.pyplot.xticks to set the locations of the x-axis tick marks.

    Without the code used to generate the question’s histogram, I resorted to creating data to produce a similar histogram. In this first example, we have a histogram with the default tick marks.

    from pylab import hist, show
    
    x = [1.1]*29 + [2]*7 + [3.2]*3 + [5]
    hist(x)
    show()
    

    Histogram with default tick marks.

    The objective is to have tick marks at 1, 2, 3, 4, and 5, and the next example does this by using xticks.

    from pylab import hist, show, xticks
    
    x = [1.1]*29 + [2]*7 + [3.2]*3 + [5]
    hist(x)
    xticks(range(1, 6))
    show()
    

    Histogram with modified tick marks.

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

Sidebar

Related Questions

I have simple histogram, but can't adjust the binwidth: qplot(factor(size_class),data=mydf,geom=histogram,binwidth = 0.01) size_class is
I have a list of int values: List<int> histogram; How do I normalize all
I have a histogram I'm drawing in matplotlib with some 260,000 values or so.
I have some values and their possibilities, actually histogram of image. My aim is
I have to plot an histogram in logarithmic scale on both axis using gnuplot.
How can I create a 3D histogram with R? For example, I have two
I have computed a histogram with cv::calcHist , and I want the histogram to
I have two questions concerning fitting a gauss curve to histogram peaks. My first
I have data of students from several schools. I want to show a histogram
I have a Python program that generates a histogram using matplotlib. The problem is

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.