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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:25:30+00:00 2026-05-27T04:25:30+00:00

I want to plot a barplot of some data with some x-axis labels but

  • 0

I want to plot a barplot of some data with some x-axis labels but so far I just keep running into the same problem, as the axis scaling is completely off limits and therefore my labels are wrongly positioned below the bars.
The most simple example I can think of:

x = c(1:81)
barplot(x)
axis(side=1,at=c(0,20,40,60,80),labels=c(20,40,60,80,100))

As you can see, the x-axis does not stretch along the whole plot but stops somewhere in between. It seems to me as if the problem is quite simple, but I somehow I am not able to fix it and I could not find any solution so far 🙁

Any help is greatly appreciated.

  • 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-27T04:25:31+00:00Added an answer on May 27, 2026 at 4:25 am

    Not sure exactly what you want, but if it is to have the labels running from one end to the other evenly placed (but not necessarily accurately), then:

    x = c(1:81)
    bp <- barplot(x)  # returns centered x axis positions as matrix
    axis(side=1,
         at=bp[1+c(0,20,40,60,80)],  # Need to increment, R uses 1-based indices
         labels=c(20,40,60,80,100))
    

    The puzzle for me was why you wanted to label "20" at 0. But this is one way to do it.

    I think Ben is mostly correct about the x-axis being for (ordered) categories, but I don’t really agree that the y values are intended to be categorical.

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

Sidebar

Related Questions

I want to plot some data into a web graph control(preferably javascript or php).
I want to plot some data. The first column contains the x-data. But matplotlib
I want to plot some confidence interval graphs in MATLAB but I don't have
I want to plot multiple data sets on the same scatter plot: cases =
I want to plot some (x,y) points on the same graph and I don't
I want to use core-plot for drawing line graph dynamically. data won't come at
I want to create a pairs plot in R that has labels on the
I am reading data continuously from a sensor and want to plot chart using
I have data that looks like this. In which I want to plot accumulative
I want to plot a confusion matrix using Pylab. The class labels along the

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.