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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:56:23+00:00 2026-06-13T11:56:23+00:00

I want to plot a bunch of variables against each other by using a

  • 0

I want to plot a bunch of variables against each other by using a loop and par(ask=T) to just update the plot after each mouse click.

The following code works fine using the plot() function:

require(ggplot2)
df1 <- data.frame(id=seq(1,10,1)
    ,col1 = runif(10)
    ,col2 = runif(10)
    ,col3 = runif(10)
    ,col4 = runif(10)
    ,col5 = runif(10)
    ,col6 = runif(10)
    ,col7 = runif(10)
    ,col8 = runif(10)
    ,col9 = runif(10)
    ,col10 = runif(10)
    )

par(ask=TRUE)
for(i in 2:9){
colName2 <- paste("col",i,sep="")
plot(df1$col1, df1[,colName2])
flush.console()
}
par(ask=FALSE)

However if I run the same code and use qplot() instead of plot(), the plot window never updates.

Any ideas why or workarounds?

  • 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-13T11:56:24+00:00Added an answer on June 13, 2026 at 11:56 am

    ggplot2 graphs are not displayed just by a call to qplot (or ggplot); when the value returned by this function is printed (as it is by default when issued on the command line), then the plot is drawn. Within a loop, the return value of a function is not printed by default, so nothing is shown. Explicitly print it, and it will show up.

    This is covered in R FAQ 7.22.

    par(ask=TRUE)
    for(i in 2:9){
      colName2 <- paste("col",i,sep="")
      print(qplot(df1$col1, df1[,colName2]))
      flush.console()
    }
    par(ask=FALSE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to plot multiple rowstacked histograms on the same graph using gnuplot. A
I want to plot several lists of points, each list has distance (decimal) and
I'm new to Perl and want to plot a chart using Excel. I found
I have a bunch of measurements over time and I want to plot them
I want to plot data against two Y-axis vs. X-axis. I debug and did
I have 6 vectors which I want to plot. How I can make each
I'm (trying to) using JSON with PHP. I want to plot a graph using
I want to plot a confusion matrix using Pylab. The class labels along the
I want to plot multiple lines on the sample plot using qplot in the
I want to plot the data points that are in a 1-D array just

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.