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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:09:15+00:00 2026-06-14T15:09:15+00:00

R plots automatically set the x and y limits to put some space between

  • 0

R plots automatically set the x and y limits to put some space between the data and the axes. I was wondering if there is a way for matplotlib to do the same automatically. If not, is there a good formula or ‘rule of thumb’ for how R sets its axis limits?

  • 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-14T15:09:16+00:00Added an answer on June 14, 2026 at 3:09 pm

    Looking at ?par for the parameter xaxs:

    The style of axis interval calculation to be used for the x-axis. Possible values are “r”, “i”, “e”, “s”, “d”. The styles are generally controlled by the range of data or xlim, if given.
    Style “r” (regular) first extends the data range by 4 percent at each end and then finds an axis with pretty labels that fits within the extended range.

    So if we try this out:

    par(xaxs="r")       #The default  
    plot(1:10, 1:10)
    

    enter image description here

    We can actually demonstrate that it’s +/- 4% of the range on each side:

    abline(v=1-(diff(range(1:10)))*0.04, col="red")
    abline(v=10+(diff(range(1:10)))*0.04, col="red")
    

    enter image description here

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

Sidebar

Related Questions

Is there a way to automatically resize a figure to properly fit contained plots
I need to get a plot that fits the data automatically using matplotlib. This
Is there a way to have the Zoom to rectangle tool automatically activated by
I'm using polar plots (POLAR(THETA,RHO)) in MATLAB. Is there an easy way to fix
like the plots in: http://www.cs.berkeley.edu/~ballard/cs267.sp11/hw1/results/ Using some statistics tool(such as R, matlab) could achieve
As when you use subplot to display plots side by side in the same
I am trying to put two scatter plots next to each other with a
I have a list to which I append Axes3D plots. Like this: self.myList.append(self.axes.plot(xValues, yValues,
I have a java application that streams raw data and draws real time plots
Hi I am ploting some data using BY GROUP option, and saving each plot

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.