[R] lattice: plotting in a loop

2009-11-25 Thread Ryan Archer
Hi,

I'm having trouble seeing graphics output from lattice xyplot() when called
from inside a for loop:

x - 1:50
for ( i in 1:5 ) {
  y - rnorm(x)
  xyplot(y~x)  # no graphics when inside for-loop
# plot(x,y)# works fine
# Sys.sleep(0.5)   # doesn't seem to help
}

The xyplot() is fine outside the loop.  Results are the same to X11 device
and to file devices.

I have noticed that there is a delay proportional to the size of the loop,
so presumably xyplot() is computing although the results aren't reaching the
graphics device.

Can anyone suggest a cause or remedy?

This is my first post to the list, although I've picked up a lot of useful
information reading here!

-Ryan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lattice: plotting in a loop

2009-11-25 Thread baptiste auguie
Hi,
it's a FAQ, you need to print() the plot,

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

baptiste

2009/11/25 Ryan Archer ra.list...@gmail.com:
 Hi,

 I'm having trouble seeing graphics output from lattice xyplot() when called
 from inside a for loop:

 x - 1:50
 for ( i in 1:5 ) {
  y - rnorm(x)
  xyplot(y~x)          # no graphics when inside for-loop
 # plot(x,y)            # works fine
 # Sys.sleep(0.5)       # doesn't seem to help
 }

 The xyplot() is fine outside the loop.  Results are the same to X11 device
 and to file devices.

 I have noticed that there is a delay proportional to the size of the loop,
 so presumably xyplot() is computing although the results aren't reaching the
 graphics device.

 Can anyone suggest a cause or remedy?

 This is my first post to the list, although I've picked up a lot of useful
 information reading here!

 -Ryan

        [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lattice: plotting in a loop

2009-11-25 Thread Ryan Archer
Ah, it's a FAQ ... thought I'd looked hard enough.  The ignominy, and for a
first post!  Well, in any case, thanks a lot Baptiste.

2009/11/25 baptiste auguie baptiste.aug...@googlemail.com

 Hi,
 it's a FAQ, you need to print() the plot,


 http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

 baptiste

 2009/11/25 Ryan Archer ra.list...@gmail.com:
  Hi,
 
  I'm having trouble seeing graphics output from lattice xyplot() when
 called
  from inside a for loop:
 
  x - 1:50
  for ( i in 1:5 ) {
   y - rnorm(x)
   xyplot(y~x)  # no graphics when inside for-loop
  # plot(x,y)# works fine
  # Sys.sleep(0.5)   # doesn't seem to help
  }
 
  The xyplot() is fine outside the loop.  Results are the same to X11
 device
  and to file devices.
 
  I have noticed that there is a delay proportional to the size of the
 loop,
  so presumably xyplot() is computing although the results aren't reaching
 the
  graphics device.
 
  Can anyone suggest a cause or remedy?
 
  This is my first post to the list, although I've picked up a lot of
 useful
  information reading here!
 
  -Ryan
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.