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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:03:39+00:00 2026-05-27T07:03:39+00:00

When plotting in R using ggplot, I’ve noticed that sometimes if you don’t specify

  • 0

When plotting in R using ggplot, I’ve noticed that sometimes if you don’t specify any limitations on the y-axis by default the plot will not have any “0” mark at the bottom of the y axis (it is assumed the bottom corner represents 0). The first plot on this page is a nice example

http://wiki.stdout.org/rcookbook/Graphs/Axes%20%28ggplot2%29

You can see that the bottom corner is left blank. This is what I would like.

But if I specify the limits of the y axis the 0 is always displayed. So if I use either

scale_y_continuous(limits=c(0,8)

or

ylim(0,8)

I get that little 0 and hash mark

So if I have a data set like:

ByYear <- data.frame( V1 = c(2005,2006,2007,2008,2005,2006,2008,2006,2007,2005,2006,2007,2008),
+                       V2 = c(0,0.2,0,1.6,2,5,0,4,3,0,8,0,5), 
+                       V3 = c('A','A','A','A','B','B','B','C','C','D','D','D','D'))

And run a basic plot like

ggplot(data=ByYear,aes(x=V1,y=V2,group=V3))+geom_line()+geom_point(aes(shape=V3),size=3)+opts(panel.grid.major=theme_blank(),panel.grid.minor=theme_blank())

Is there a way I can have the first hash mark be blank? Something akin to

ylim(,8)  #(Even though it does not work)

I know I can use

expand=c(0,0)) or yaxis="i"

To bring the 0 mark down to the lower corner (which is better), but the only problem is because I have a lot of zero data this will cut off the bottom of the point shapes so I still need that little bit of buffer space below the zero point.

  • 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-27T07:03:39+00:00Added an answer on May 27, 2026 at 7:03 am

    I think you may be looking for the breaks argument of scale_y_continuous:

    ggplot(data=ByYear,aes(x=V1,y=V2,group=V3)) + 
        geom_line() + 
        geom_point(aes(shape=V3),size=3) + 
        scale_y_continuous(breaks = 1:8) +
        opts(panel.grid.major=theme_blank(),panel.grid.minor=theme_blank())
    

    which produces this:

    enter image description here

    Note: Since version 0.9.2 opts has been replaced by theme:

    + theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am plotting a dataset using the following: plot = ggplot(transData, aes(x=Time, y=Value)) +
I have many coordinates that I am plotting using a MKMapOverlay and CoreLocation and
Using the ZedGraph control, say I am plotting data that has Y values of
When plotting surfaces using mpl_toolkits.mplot3d.Axes3D.plot_surface() , lines appear that seem to follow the curve
when plotting my data using gnuplot, I experience that the right border is cut
I am thinking of using wxMathPlot for plotting/graphing some data that arrives continuously. I
I am plotting two lines using plot(x, y, type = l, color = red)
I am plotting some curves using twin-axis and also scientific notation. I have set
Is there an equivalent method for plotting functions using ggplot to the curve() command
When plotting a function using Plot, I would like to obtain the set of

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.