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 question.(5)

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

ITtutoria

ITtutoria Logo ITtutoria Logo

ITtutoria Navigation

  • Python
  • Java
  • Reactjs
  • JavaScript
  • R
  • PySpark
  • MYSQL
  • Pandas
  • QA
  • C++
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA
Home/ Questions/Stabilizing the error with the best answers: error in plot.window(...) : need finite 'xlim' values
Next
Answered
Julia Joly
  • 8
Julia Joly
Asked: May 12, 20222022-05-12T11:41:18+00:00 2022-05-12T11:41:18+00:00In: r

Stabilizing the error with the best answers: error in plot.window(…) : need finite ‘xlim’ values

  • 8

. Advertisement .

..3..

. Advertisement .

..4..

As advised, I used some code samples in another forum but it could not improve the problem. My question is the “ error in plot.window(…) : need finite ‘xlim’ values ” in r- how to solve it? Command line is:

#define data
x <- c('A', 'B', 'C', 'D', 'E', 'F')

y <- c(3, 6, 7, 8, 14, 19)

#attempt to create scatterplot

plot(x, y)

and the result:

Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

What does the message mean? Can you advise me to fix it? If you have other better answers, leave it in the answer box below.

error in plot.window(...)
  • 2 2 Answers
  • 78 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Best Answer
    lyytutoria Expert
    2022-05-31T23:37:22+00:00Added an answer on May 31, 2022 at 11:37 pm

    The cause: This error occurs because the vector we used for the x-axis values is a character vector.

    Solution: Supplying a numeric vector to the x-axis:

    #define two numeric vectors 
    
    x <- c(1, 2, 3, 4, 5, 6) 
    
    y <- c(3, 6, 7, 8, 14, 19) 
    
    #create scatterplot 
    
    plot(x, y)

    • 7
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Paul Gosselin
    2022-05-26T03:56:07+00:00Added an answer on May 26, 2022 at 3:56 am

    Problem is, you are (probably) trying plot a vector consisting only of missing (NA), values. Here’s an example.

    > x=rep(NA,100)
    > y=rnorm(100)
    > plot(x,y)
    Error in plot.window(...) : need finite 'xlim' values
    In addition: Warning messages:
    1: In min(x) : no non-missing arguments to min; returning Inf
    2: In max(x) : no non-missing arguments to max; returning -Inf

    This means that plot(costs,pseudor2,type="l") is costs and NA is plot(costs,pseudor2,type="l"). This is the reason for your error.


    Comments:

    Scott C Wilson Attempting to use character values in X and Y data is another possible reason for this message. If you suspect this is the problem, you can use class function to verify your x- and y values.

    Stevec

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

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question
  • How to Split String by space in C++
  • How To Convert A Pandas DataFrame Column To A List
  • How to Replace Multiple Characters in A String in Python?
  • How To Remove Special Characters From String Python

Explore

  • Home
  • Tutorial

Footer

ITtutoria

ITtutoria

This website is user friendly and will facilitate transferring knowledge. It would be useful for a self-initiated learning process.

@ ITTutoria Co Ltd.

Tutorial

  • Home
  • Python
  • Science
  • Java
  • JavaScript
  • Reactjs
  • Nodejs
  • Tools
  • QA

Legal Stuff

  • About Us
  • Terms of Use
  • Privacy Policy
  • Contact Us

DMCA.com Protection Status

Help

  • Knowledge Base
  • Support

Follow

© 2022 Ittutoria. All Rights Reserved.

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.