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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:05:25+00:00 2026-06-08T20:05:25+00:00

I am trying to create a simple bar graph including two bars showing the

  • 0

I am trying to create a simple bar graph including two bars showing the average math scores of two groups of students. The averages are 363.2 and 377.4. creating bar graph is simple. What I’d like to do is to have my y-axis starts from 340 rather than 0. I do know how to change the limits of y-axis, but the issue is when I change the limit of y-axis to c(340, 380), R still draws the whole bar which most of it is below the x-axis!

Here is my code:

barplot(c(363.2, 377.4), beside = T, ylim = c(340,380), col = c("orange", "blue"))

I’ve also attached my plot:

  • 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-08T20:05:27+00:00Added an answer on June 8, 2026 at 8:05 pm

    Adding xpd=FALSE and re-adding the horizontal axis works, sort of:

    b <- barplot(c(363.2, 377.4), beside = TRUE, 
       ylim = c(340,380), col = c("orange", "blue"),xpd=FALSE)
    axis(side=1,at=b,labels=c("group 1", "group 2"))
    box(bty="l")
    

    I claim (I can’t point you to a definitive reference, although Googling “bar plot zero axis” seems to come up with useful stuff; perhaps others will chime in) that it is bad practice to draw bar graphs where the vertical axis does not include zero: the argument is that the viewer will assume that bar graphs are anchored to the origin (this argument is more commonly made when explaining why R doesn’t make it easy to use a logarithmic axis for barplots: see comments here, for example). Those who feel this way would say you should use points to indicate the value instead; in this case the implicit assumption of zero-anchoring does not hold as strongly.

    In other words, “here’s how you can do this — but you shouldn’t” …

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

Sidebar

Related Questions

I'm trying to create a simple app for android with progress bar . Everything
I am trying to find the best option to create a simple progress bar
I'm trying to create a simple full screen site where the side bar is
I'm trying to create a very simple bar chart using the results of a
I'm trying to create a simple menu in the System Status Bar using code
I am trying to create a simple tab bar for a site that has
I am trying to create a simple GUI. I have a menu bar that
What I'm trying to create is a simple progress bar, that would load for
I'm trying to create simple script that subscribes a user to a company calendar.
I'm studying webrat and cucumber and trying to create simple example. Here is my

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.