plot.new has not been called yet











up vote
34
down vote

favorite
1












Why does this happen?



plot(x,y)
yx.lm <- lm(y ~ x)
lines(x, predict(yx.lm), col="red")



Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet











share|improve this question




















  • 1




    Works here when applied to two short vectors. Please show us str(x) and str(y).
    – NPE
    Aug 22 '11 at 22:04








  • 3




    How do you expect us to comment with specifics? We don't have x, y, nor the code used to fit the linear model. Please help us to help you.
    – Gavin Simpson
    Aug 22 '11 at 22:32

















up vote
34
down vote

favorite
1












Why does this happen?



plot(x,y)
yx.lm <- lm(y ~ x)
lines(x, predict(yx.lm), col="red")



Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet











share|improve this question




















  • 1




    Works here when applied to two short vectors. Please show us str(x) and str(y).
    – NPE
    Aug 22 '11 at 22:04








  • 3




    How do you expect us to comment with specifics? We don't have x, y, nor the code used to fit the linear model. Please help us to help you.
    – Gavin Simpson
    Aug 22 '11 at 22:32















up vote
34
down vote

favorite
1









up vote
34
down vote

favorite
1






1





Why does this happen?



plot(x,y)
yx.lm <- lm(y ~ x)
lines(x, predict(yx.lm), col="red")



Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet











share|improve this question















Why does this happen?



plot(x,y)
yx.lm <- lm(y ~ x)
lines(x, predict(yx.lm), col="red")



Error in plot.xy(xy.coords(x, y), type = type, ...) :
plot.new has not been called yet








r plot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 12 '16 at 13:36









MichaelChirico

19.6k859109




19.6k859109










asked Aug 22 '11 at 22:01









optform

332366




332366








  • 1




    Works here when applied to two short vectors. Please show us str(x) and str(y).
    – NPE
    Aug 22 '11 at 22:04








  • 3




    How do you expect us to comment with specifics? We don't have x, y, nor the code used to fit the linear model. Please help us to help you.
    – Gavin Simpson
    Aug 22 '11 at 22:32
















  • 1




    Works here when applied to two short vectors. Please show us str(x) and str(y).
    – NPE
    Aug 22 '11 at 22:04








  • 3




    How do you expect us to comment with specifics? We don't have x, y, nor the code used to fit the linear model. Please help us to help you.
    – Gavin Simpson
    Aug 22 '11 at 22:32










1




1




Works here when applied to two short vectors. Please show us str(x) and str(y).
– NPE
Aug 22 '11 at 22:04






Works here when applied to two short vectors. Please show us str(x) and str(y).
– NPE
Aug 22 '11 at 22:04






3




3




How do you expect us to comment with specifics? We don't have x, y, nor the code used to fit the linear model. Please help us to help you.
– Gavin Simpson
Aug 22 '11 at 22:32






How do you expect us to comment with specifics? We don't have x, y, nor the code used to fit the linear model. Please help us to help you.
– Gavin Simpson
Aug 22 '11 at 22:32














6 Answers
6






active

oldest

votes

















up vote
28
down vote













Some action, very possibly not represented in the visible code, has closed the interactive screen device. It could be done either by a "click" on a close-button. (Could also be done by an extra dev.off() when plotting to a file-graphics device. This may happen if you paste in a mult-line plotting command that has a dev,off() at the end of it but errors out at the opening of the external device but then has hte dev.off() on a separate line so it accidentally closes the interactive device).



Some (most?) R implementations will start up a screen graphics device open automatically, but if you close it down, you then need to re-initialize it. On Windows that might be window(); on a Mac, quartz(); and on a linux box, x11(). You also may need to issue a plot.new() command. I just follow orders. When I get that error I issue plot.new() and if I don't see a plot window, I issue quartz() as well. I then start over from the beginning with a new plot(., ., ...) command and any further additions to that plot screen image.






share|improve this answer



















  • 6




    This answer is similar to the "if in doubt, reformat your hard drive" advice. There's no need to add unwanted plot.new() calls. The OP (obviously) left out his lm() call, and most likely some other call that closed is plot window. plot.new() will not "re-attach" to the existing plot of x vs y, so his lines() call wouldn't be written to that plot.
    – Carl Witthoft
    Aug 23 '11 at 11:30










  • If it is at worst harmless, then it is not similar to your example nor even similar to rm(list=ls()).
    – 42-
    Aug 23 '11 at 13:16






  • 1




    It is not always harmless. And as I pointed out, plot(x,y);plot.new();lines(...) will not do what the OP wanted
    – Carl Witthoft
    Aug 23 '11 at 15:42












  • I suppose. I didn't imagine that it would have been issued between the plot and the lines commands. I was assuming it would be issued before the plot call. As I said ... after the interactive graphics device has been re-initialized, I then redo the plotting operation from the beginning.
    – 42-
    Dec 18 '13 at 16:17






  • 2




    on linux, I used plot.new().
    – dorien
    Oct 23 '14 at 18:11


















up vote
7
down vote













In my case, I was trying to call plot(x, y) and lines(x, predict(yx.lm), col="red") in two separate chunks in Rmarkdown file. It worked without problems when running chunk by chunk, but the corresponding document wouldn't knit. After I moved all plotting calls within one chunk, problem was resolved.






share|improve this answer

















  • 3




    You also get the error if you try to run the lines separately within the same chunk, rather than executing the whole thing. I guess it calls dev.off() somewhere under the hood?
    – Gabriel
    Apr 28 '17 at 15:18


















up vote
2
down vote













As a newbie, I faced the same 'problem'.



In newbie terms :
when you call plot(), the graph window gets the focus and you cannot enter further commands into R. That is when you conclude that you must close the graph window to return to R.
However, some commands, like identify(), act on open/active graph windows.
When identify() cannot find an open/active graph window, it gives this error message.



However, you can simply click on the R window without closing the graph window. Then you can type more commands at the R prompt, like identify() etc.






share|improve this answer






























    up vote
    1
    down vote













    I had the same problem... my problem was that I was closing my quartz window after plot(x,y). Once I kept it open, the lines that previously resulted in errors just added things to my plot (like they were supposed to). Hopefully this might help some people who arrive at this page.






    share|improve this answer




























      up vote
      1
      down vote













      If someone is using print function (for example, with mtext), then firstly depict a null plot:



      plot(0,type='n',axes=FALSE,ann=FALSE)


      and then print with newpage = F



      print(data, newpage = F)





      share|improve this answer




























        up vote
        0
        down vote













        plot.new() error occurs when only part of the function is ran.



        Please find the attachment for an example to correct error
        With error....When abline is ran without plot() above
        enter image description here
        Error-free ...When both plot and abline ran together
        enter image description here






        share|improve this answer





















          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7154133%2fplot-new-has-not-been-called-yet%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          6 Answers
          6






          active

          oldest

          votes








          6 Answers
          6






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          28
          down vote













          Some action, very possibly not represented in the visible code, has closed the interactive screen device. It could be done either by a "click" on a close-button. (Could also be done by an extra dev.off() when plotting to a file-graphics device. This may happen if you paste in a mult-line plotting command that has a dev,off() at the end of it but errors out at the opening of the external device but then has hte dev.off() on a separate line so it accidentally closes the interactive device).



          Some (most?) R implementations will start up a screen graphics device open automatically, but if you close it down, you then need to re-initialize it. On Windows that might be window(); on a Mac, quartz(); and on a linux box, x11(). You also may need to issue a plot.new() command. I just follow orders. When I get that error I issue plot.new() and if I don't see a plot window, I issue quartz() as well. I then start over from the beginning with a new plot(., ., ...) command and any further additions to that plot screen image.






          share|improve this answer



















          • 6




            This answer is similar to the "if in doubt, reformat your hard drive" advice. There's no need to add unwanted plot.new() calls. The OP (obviously) left out his lm() call, and most likely some other call that closed is plot window. plot.new() will not "re-attach" to the existing plot of x vs y, so his lines() call wouldn't be written to that plot.
            – Carl Witthoft
            Aug 23 '11 at 11:30










          • If it is at worst harmless, then it is not similar to your example nor even similar to rm(list=ls()).
            – 42-
            Aug 23 '11 at 13:16






          • 1




            It is not always harmless. And as I pointed out, plot(x,y);plot.new();lines(...) will not do what the OP wanted
            – Carl Witthoft
            Aug 23 '11 at 15:42












          • I suppose. I didn't imagine that it would have been issued between the plot and the lines commands. I was assuming it would be issued before the plot call. As I said ... after the interactive graphics device has been re-initialized, I then redo the plotting operation from the beginning.
            – 42-
            Dec 18 '13 at 16:17






          • 2




            on linux, I used plot.new().
            – dorien
            Oct 23 '14 at 18:11















          up vote
          28
          down vote













          Some action, very possibly not represented in the visible code, has closed the interactive screen device. It could be done either by a "click" on a close-button. (Could also be done by an extra dev.off() when plotting to a file-graphics device. This may happen if you paste in a mult-line plotting command that has a dev,off() at the end of it but errors out at the opening of the external device but then has hte dev.off() on a separate line so it accidentally closes the interactive device).



          Some (most?) R implementations will start up a screen graphics device open automatically, but if you close it down, you then need to re-initialize it. On Windows that might be window(); on a Mac, quartz(); and on a linux box, x11(). You also may need to issue a plot.new() command. I just follow orders. When I get that error I issue plot.new() and if I don't see a plot window, I issue quartz() as well. I then start over from the beginning with a new plot(., ., ...) command and any further additions to that plot screen image.






          share|improve this answer



















          • 6




            This answer is similar to the "if in doubt, reformat your hard drive" advice. There's no need to add unwanted plot.new() calls. The OP (obviously) left out his lm() call, and most likely some other call that closed is plot window. plot.new() will not "re-attach" to the existing plot of x vs y, so his lines() call wouldn't be written to that plot.
            – Carl Witthoft
            Aug 23 '11 at 11:30










          • If it is at worst harmless, then it is not similar to your example nor even similar to rm(list=ls()).
            – 42-
            Aug 23 '11 at 13:16






          • 1




            It is not always harmless. And as I pointed out, plot(x,y);plot.new();lines(...) will not do what the OP wanted
            – Carl Witthoft
            Aug 23 '11 at 15:42












          • I suppose. I didn't imagine that it would have been issued between the plot and the lines commands. I was assuming it would be issued before the plot call. As I said ... after the interactive graphics device has been re-initialized, I then redo the plotting operation from the beginning.
            – 42-
            Dec 18 '13 at 16:17






          • 2




            on linux, I used plot.new().
            – dorien
            Oct 23 '14 at 18:11













          up vote
          28
          down vote










          up vote
          28
          down vote









          Some action, very possibly not represented in the visible code, has closed the interactive screen device. It could be done either by a "click" on a close-button. (Could also be done by an extra dev.off() when plotting to a file-graphics device. This may happen if you paste in a mult-line plotting command that has a dev,off() at the end of it but errors out at the opening of the external device but then has hte dev.off() on a separate line so it accidentally closes the interactive device).



          Some (most?) R implementations will start up a screen graphics device open automatically, but if you close it down, you then need to re-initialize it. On Windows that might be window(); on a Mac, quartz(); and on a linux box, x11(). You also may need to issue a plot.new() command. I just follow orders. When I get that error I issue plot.new() and if I don't see a plot window, I issue quartz() as well. I then start over from the beginning with a new plot(., ., ...) command and any further additions to that plot screen image.






          share|improve this answer














          Some action, very possibly not represented in the visible code, has closed the interactive screen device. It could be done either by a "click" on a close-button. (Could also be done by an extra dev.off() when plotting to a file-graphics device. This may happen if you paste in a mult-line plotting command that has a dev,off() at the end of it but errors out at the opening of the external device but then has hte dev.off() on a separate line so it accidentally closes the interactive device).



          Some (most?) R implementations will start up a screen graphics device open automatically, but if you close it down, you then need to re-initialize it. On Windows that might be window(); on a Mac, quartz(); and on a linux box, x11(). You also may need to issue a plot.new() command. I just follow orders. When I get that error I issue plot.new() and if I don't see a plot window, I issue quartz() as well. I then start over from the beginning with a new plot(., ., ...) command and any further additions to that plot screen image.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 4 '15 at 16:23

























          answered Aug 22 '11 at 22:15









          42-

          210k14249394




          210k14249394








          • 6




            This answer is similar to the "if in doubt, reformat your hard drive" advice. There's no need to add unwanted plot.new() calls. The OP (obviously) left out his lm() call, and most likely some other call that closed is plot window. plot.new() will not "re-attach" to the existing plot of x vs y, so his lines() call wouldn't be written to that plot.
            – Carl Witthoft
            Aug 23 '11 at 11:30










          • If it is at worst harmless, then it is not similar to your example nor even similar to rm(list=ls()).
            – 42-
            Aug 23 '11 at 13:16






          • 1




            It is not always harmless. And as I pointed out, plot(x,y);plot.new();lines(...) will not do what the OP wanted
            – Carl Witthoft
            Aug 23 '11 at 15:42












          • I suppose. I didn't imagine that it would have been issued between the plot and the lines commands. I was assuming it would be issued before the plot call. As I said ... after the interactive graphics device has been re-initialized, I then redo the plotting operation from the beginning.
            – 42-
            Dec 18 '13 at 16:17






          • 2




            on linux, I used plot.new().
            – dorien
            Oct 23 '14 at 18:11














          • 6




            This answer is similar to the "if in doubt, reformat your hard drive" advice. There's no need to add unwanted plot.new() calls. The OP (obviously) left out his lm() call, and most likely some other call that closed is plot window. plot.new() will not "re-attach" to the existing plot of x vs y, so his lines() call wouldn't be written to that plot.
            – Carl Witthoft
            Aug 23 '11 at 11:30










          • If it is at worst harmless, then it is not similar to your example nor even similar to rm(list=ls()).
            – 42-
            Aug 23 '11 at 13:16






          • 1




            It is not always harmless. And as I pointed out, plot(x,y);plot.new();lines(...) will not do what the OP wanted
            – Carl Witthoft
            Aug 23 '11 at 15:42












          • I suppose. I didn't imagine that it would have been issued between the plot and the lines commands. I was assuming it would be issued before the plot call. As I said ... after the interactive graphics device has been re-initialized, I then redo the plotting operation from the beginning.
            – 42-
            Dec 18 '13 at 16:17






          • 2




            on linux, I used plot.new().
            – dorien
            Oct 23 '14 at 18:11








          6




          6




          This answer is similar to the "if in doubt, reformat your hard drive" advice. There's no need to add unwanted plot.new() calls. The OP (obviously) left out his lm() call, and most likely some other call that closed is plot window. plot.new() will not "re-attach" to the existing plot of x vs y, so his lines() call wouldn't be written to that plot.
          – Carl Witthoft
          Aug 23 '11 at 11:30




          This answer is similar to the "if in doubt, reformat your hard drive" advice. There's no need to add unwanted plot.new() calls. The OP (obviously) left out his lm() call, and most likely some other call that closed is plot window. plot.new() will not "re-attach" to the existing plot of x vs y, so his lines() call wouldn't be written to that plot.
          – Carl Witthoft
          Aug 23 '11 at 11:30












          If it is at worst harmless, then it is not similar to your example nor even similar to rm(list=ls()).
          – 42-
          Aug 23 '11 at 13:16




          If it is at worst harmless, then it is not similar to your example nor even similar to rm(list=ls()).
          – 42-
          Aug 23 '11 at 13:16




          1




          1




          It is not always harmless. And as I pointed out, plot(x,y);plot.new();lines(...) will not do what the OP wanted
          – Carl Witthoft
          Aug 23 '11 at 15:42






          It is not always harmless. And as I pointed out, plot(x,y);plot.new();lines(...) will not do what the OP wanted
          – Carl Witthoft
          Aug 23 '11 at 15:42














          I suppose. I didn't imagine that it would have been issued between the plot and the lines commands. I was assuming it would be issued before the plot call. As I said ... after the interactive graphics device has been re-initialized, I then redo the plotting operation from the beginning.
          – 42-
          Dec 18 '13 at 16:17




          I suppose. I didn't imagine that it would have been issued between the plot and the lines commands. I was assuming it would be issued before the plot call. As I said ... after the interactive graphics device has been re-initialized, I then redo the plotting operation from the beginning.
          – 42-
          Dec 18 '13 at 16:17




          2




          2




          on linux, I used plot.new().
          – dorien
          Oct 23 '14 at 18:11




          on linux, I used plot.new().
          – dorien
          Oct 23 '14 at 18:11












          up vote
          7
          down vote













          In my case, I was trying to call plot(x, y) and lines(x, predict(yx.lm), col="red") in two separate chunks in Rmarkdown file. It worked without problems when running chunk by chunk, but the corresponding document wouldn't knit. After I moved all plotting calls within one chunk, problem was resolved.






          share|improve this answer

















          • 3




            You also get the error if you try to run the lines separately within the same chunk, rather than executing the whole thing. I guess it calls dev.off() somewhere under the hood?
            – Gabriel
            Apr 28 '17 at 15:18















          up vote
          7
          down vote













          In my case, I was trying to call plot(x, y) and lines(x, predict(yx.lm), col="red") in two separate chunks in Rmarkdown file. It worked without problems when running chunk by chunk, but the corresponding document wouldn't knit. After I moved all plotting calls within one chunk, problem was resolved.






          share|improve this answer

















          • 3




            You also get the error if you try to run the lines separately within the same chunk, rather than executing the whole thing. I guess it calls dev.off() somewhere under the hood?
            – Gabriel
            Apr 28 '17 at 15:18













          up vote
          7
          down vote










          up vote
          7
          down vote









          In my case, I was trying to call plot(x, y) and lines(x, predict(yx.lm), col="red") in two separate chunks in Rmarkdown file. It worked without problems when running chunk by chunk, but the corresponding document wouldn't knit. After I moved all plotting calls within one chunk, problem was resolved.






          share|improve this answer












          In my case, I was trying to call plot(x, y) and lines(x, predict(yx.lm), col="red") in two separate chunks in Rmarkdown file. It worked without problems when running chunk by chunk, but the corresponding document wouldn't knit. After I moved all plotting calls within one chunk, problem was resolved.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 3 '16 at 15:12









          Jelena-bioinf

          1,48011424




          1,48011424








          • 3




            You also get the error if you try to run the lines separately within the same chunk, rather than executing the whole thing. I guess it calls dev.off() somewhere under the hood?
            – Gabriel
            Apr 28 '17 at 15:18














          • 3




            You also get the error if you try to run the lines separately within the same chunk, rather than executing the whole thing. I guess it calls dev.off() somewhere under the hood?
            – Gabriel
            Apr 28 '17 at 15:18








          3




          3




          You also get the error if you try to run the lines separately within the same chunk, rather than executing the whole thing. I guess it calls dev.off() somewhere under the hood?
          – Gabriel
          Apr 28 '17 at 15:18




          You also get the error if you try to run the lines separately within the same chunk, rather than executing the whole thing. I guess it calls dev.off() somewhere under the hood?
          – Gabriel
          Apr 28 '17 at 15:18










          up vote
          2
          down vote













          As a newbie, I faced the same 'problem'.



          In newbie terms :
          when you call plot(), the graph window gets the focus and you cannot enter further commands into R. That is when you conclude that you must close the graph window to return to R.
          However, some commands, like identify(), act on open/active graph windows.
          When identify() cannot find an open/active graph window, it gives this error message.



          However, you can simply click on the R window without closing the graph window. Then you can type more commands at the R prompt, like identify() etc.






          share|improve this answer



























            up vote
            2
            down vote













            As a newbie, I faced the same 'problem'.



            In newbie terms :
            when you call plot(), the graph window gets the focus and you cannot enter further commands into R. That is when you conclude that you must close the graph window to return to R.
            However, some commands, like identify(), act on open/active graph windows.
            When identify() cannot find an open/active graph window, it gives this error message.



            However, you can simply click on the R window without closing the graph window. Then you can type more commands at the R prompt, like identify() etc.






            share|improve this answer

























              up vote
              2
              down vote










              up vote
              2
              down vote









              As a newbie, I faced the same 'problem'.



              In newbie terms :
              when you call plot(), the graph window gets the focus and you cannot enter further commands into R. That is when you conclude that you must close the graph window to return to R.
              However, some commands, like identify(), act on open/active graph windows.
              When identify() cannot find an open/active graph window, it gives this error message.



              However, you can simply click on the R window without closing the graph window. Then you can type more commands at the R prompt, like identify() etc.






              share|improve this answer














              As a newbie, I faced the same 'problem'.



              In newbie terms :
              when you call plot(), the graph window gets the focus and you cannot enter further commands into R. That is when you conclude that you must close the graph window to return to R.
              However, some commands, like identify(), act on open/active graph windows.
              When identify() cannot find an open/active graph window, it gives this error message.



              However, you can simply click on the R window without closing the graph window. Then you can type more commands at the R prompt, like identify() etc.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Mar 6 '16 at 15:19









              Community

              11




              11










              answered Mar 5 '16 at 21:40









              Ronnie

              211




              211






















                  up vote
                  1
                  down vote













                  I had the same problem... my problem was that I was closing my quartz window after plot(x,y). Once I kept it open, the lines that previously resulted in errors just added things to my plot (like they were supposed to). Hopefully this might help some people who arrive at this page.






                  share|improve this answer

























                    up vote
                    1
                    down vote













                    I had the same problem... my problem was that I was closing my quartz window after plot(x,y). Once I kept it open, the lines that previously resulted in errors just added things to my plot (like they were supposed to). Hopefully this might help some people who arrive at this page.






                    share|improve this answer























                      up vote
                      1
                      down vote










                      up vote
                      1
                      down vote









                      I had the same problem... my problem was that I was closing my quartz window after plot(x,y). Once I kept it open, the lines that previously resulted in errors just added things to my plot (like they were supposed to). Hopefully this might help some people who arrive at this page.






                      share|improve this answer












                      I had the same problem... my problem was that I was closing my quartz window after plot(x,y). Once I kept it open, the lines that previously resulted in errors just added things to my plot (like they were supposed to). Hopefully this might help some people who arrive at this page.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jun 28 '13 at 16:50









                      Hank

                      111




                      111






















                          up vote
                          1
                          down vote













                          If someone is using print function (for example, with mtext), then firstly depict a null plot:



                          plot(0,type='n',axes=FALSE,ann=FALSE)


                          and then print with newpage = F



                          print(data, newpage = F)





                          share|improve this answer

























                            up vote
                            1
                            down vote













                            If someone is using print function (for example, with mtext), then firstly depict a null plot:



                            plot(0,type='n',axes=FALSE,ann=FALSE)


                            and then print with newpage = F



                            print(data, newpage = F)





                            share|improve this answer























                              up vote
                              1
                              down vote










                              up vote
                              1
                              down vote









                              If someone is using print function (for example, with mtext), then firstly depict a null plot:



                              plot(0,type='n',axes=FALSE,ann=FALSE)


                              and then print with newpage = F



                              print(data, newpage = F)





                              share|improve this answer












                              If someone is using print function (for example, with mtext), then firstly depict a null plot:



                              plot(0,type='n',axes=FALSE,ann=FALSE)


                              and then print with newpage = F



                              print(data, newpage = F)






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jun 3 '16 at 14:56









                              Alex Nevsky

                              8871020




                              8871020






















                                  up vote
                                  0
                                  down vote













                                  plot.new() error occurs when only part of the function is ran.



                                  Please find the attachment for an example to correct error
                                  With error....When abline is ran without plot() above
                                  enter image description here
                                  Error-free ...When both plot and abline ran together
                                  enter image description here






                                  share|improve this answer

























                                    up vote
                                    0
                                    down vote













                                    plot.new() error occurs when only part of the function is ran.



                                    Please find the attachment for an example to correct error
                                    With error....When abline is ran without plot() above
                                    enter image description here
                                    Error-free ...When both plot and abline ran together
                                    enter image description here






                                    share|improve this answer























                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      plot.new() error occurs when only part of the function is ran.



                                      Please find the attachment for an example to correct error
                                      With error....When abline is ran without plot() above
                                      enter image description here
                                      Error-free ...When both plot and abline ran together
                                      enter image description here






                                      share|improve this answer












                                      plot.new() error occurs when only part of the function is ran.



                                      Please find the attachment for an example to correct error
                                      With error....When abline is ran without plot() above
                                      enter image description here
                                      Error-free ...When both plot and abline ran together
                                      enter image description here







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jan 11 at 10:48









                                      Abhishek

                                      300212




                                      300212






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7154133%2fplot-new-has-not-been-called-yet%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                                          Calculate evaluation metrics using cross_val_predict sklearn

                                          Insert data from modal to MySQL (multiple modal on website)