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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:46:16+00:00 2026-05-22T11:46:16+00:00

In the example below I would like to be able to control when I

  • 0

In the example below I would like to be able to control when I go to the next plot by a using mouse click (or keyboard entry)

for (i in 1:5){
    plot(1:i)
    Sys.sleep(1)
    #add something here that requests mouse click to proceed
}

Is this possible? There is a setting in the X11() help file caled ‘clickToConfirm’ but I can’t work out what that does.

It would also be helpful to me to be to be able to scroll back and forth through plots using the arrow keys. Is this possible?

Currently if I need to look at lots of plots I output them into a big .pdf file and scroll though them all there, but that is a bit cumbersome.

Thanks

Tom

  • 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-22T11:46:17+00:00Added an answer on May 22, 2026 at 11:46 am

    In R, that would be done by setting par(ask=TRUE). Try the following code, which shows how to reset the par when exiting the function :

    op <- par(ask=TRUE)
    for (i in 1:5){
        plot(1:i)
    }
    par(op)
    

    If you want to keep a history to browse through, you can either open a window and click on recording in the History menu, or you can open the window yourself with the history on. Demonstrated in a function :

    plot.fun <- function(){
        windows(record=TRUE) # opens a window and starts recording
        op <- par(ask=TRUE)
        on.exit(par(op))
    
        for (i in 1:5){
            plot(1:i)
        }
        windows.options(record=FALSE) #stops recording.
    }
    plot.fun()
    

    This will however keep all previous plots in the history for browsing as well, so if you run this code 3 times you’ll have 15 plots in the plot history. Also note that the open plot window will keep on recording until you turn off the recording in the menu.

    You can play with the plot history, as you’ll have a variable .SavedPlots which contains the saved plot history. It can be cleared using the menu History > clear history in the plot window. If you want to clear the history from the console, you could hack that by

    .SavedPlots <- NULL 
    

    But I advise you not to do this, as changing the .SavedPlots variable can cause R to crash.

    See also ?windows and ?recordPlot for a bit more information. But as you’re getting close to the internal code of R, be warned that you can get pretty awkward behaviour if you start playing around with these things.

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

Sidebar

Related Questions

I would like to create a few overloaded methods which accept a Func parameter.
I would like to query with linq some xml file. There are some required
I am working on a site that has a database schema like a tree.
I'm currently using ajax and jquery to update search results with a form that
I am developing a GUI app on WinXP but unfortunately std::cerr/cout goes nowhere. I
I'm trying to figure out how cookies can be used to prevent a hacker
I have bash script that takes in a couple of arguments tests then and
I have a mainActivity which is Customer.java with listview of 5 diff. activities. I
![enter image description here][1] I want to make a tab layout application, in which

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.