Re: [R] tip: large plots

2011-11-22 Thread MacQueen, Don
And even more for the heck of it... this kind of thing is also
device-dependent.

(this is *not* a controlled test; some variation could be due to other
processes running on the machine)

-Don

> x11(type='Xlib')
> system.time(plot(runif(1e6),runif(1e6)))
   user  system elapsed
  0.712   0.165   2.129

> dev.off()
null device 
  1 

> x11(type='cairo')
> system.time(plot(runif(1e6),runif(1e6)))
   user  system elapsed
 48.444   0.169  49.051

> dev.off()
null device 
  1 

> quartz()
> system.time(plot(runif(1e6),runif(1e6)))
   user  system elapsed
 36.358   0.097  36.485

> sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] rmacq_1.1-3



-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 11/19/11 3:17 PM, "Carl Witthoft"  wrote:

>Another few data points, just for the heck of it.  This is on a 2.66GHz
>Intel Core Duo iMac.
>
>
>Rgames> system.time(plot(runif(1e6),runif(1e6)))
>user  system elapsed
>  34.405   0.079  34.432
>Rgames> system.time(plot(runif(1e6),runif(1e6),pch='.'))
>user  system elapsed
>  12.602   0.032  12.596
>
>Rgames> system.time(print(xyplot(runif(1e6)~runif(1e6
>user  system elapsed
>  36.651   0.837  37.371
>
>Rgames> system.time(print(xyplot(runif(1e6)~runif(1e6),pch='.')))
>user  system elapsed
>  16.866   0.777  17.578
>
>Rgames> system.time(scatterplot3d(runif(1e6),runif(1e6),rep(1,1e6)))
>user  system elapsed
>  36.081   0.959  36.932
>Rgames> 
>system.time(scatterplot3d(runif(1e6),runif(1e6),rep(1,1e6),cex.symbols='.'
>))
>user  system elapsed
>  18.834   0.864  19.629
>-- 
>
>Sent from my Cray XK6
>"Pendeo-navem mei anguillae plena est."
>
>__
>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] tip: large plots

2011-11-19 Thread Carl Witthoft
Another few data points, just for the heck of it.  This is on a 2.66GHz 
Intel Core Duo iMac.



Rgames> system.time(plot(runif(1e6),runif(1e6)))
   user  system elapsed
 34.405   0.079  34.432
Rgames> system.time(plot(runif(1e6),runif(1e6),pch='.'))
   user  system elapsed
 12.602   0.032  12.596

Rgames> system.time(print(xyplot(runif(1e6)~runif(1e6
   user  system elapsed
 36.651   0.837  37.371

Rgames> system.time(print(xyplot(runif(1e6)~runif(1e6),pch='.')))
   user  system elapsed
 16.866   0.777  17.578

Rgames> system.time(scatterplot3d(runif(1e6),runif(1e6),rep(1,1e6)))
   user  system elapsed
 36.081   0.959  36.932
Rgames> 
system.time(scatterplot3d(runif(1e6),runif(1e6),rep(1,1e6),cex.symbols='.'))

   user  system elapsed
 18.834   0.864  19.629
--

Sent from my Cray XK6
"Pendeo-navem mei anguillae plena est."

__
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] tip: large plots

2011-11-18 Thread Franklin Bretschneider
Dear Sarah,

RE:

> Hi all,
> 
> I'm working with a bunch of large graphs, and stumbled across
> something useful. Probably many of you know this, but I didn't and so
> others might benefit.
> 
> Using pch="." speeds up plotting considerably over using symbols.
> 
>> x <- runif(100)
>> y <- runif(100)
>> system.time(plot(x, y, pch="."))
>   user  system elapsed
>  1.042   0.030   1.077
>> system.time(plot(x, y))
>   user  system elapsed
> 37.865   0.033  38.122
> 
> If you have enough points, the result is also more legible.
> 
> Choice of which pch symbol makes a difference too, the default pch=1 being
> the slowest of what I tried, but "." is by far the speediest.
> 
>> system.time(plot(x, y, pch=0))
>   user  system elapsed
> 11.191   0.011  11.270
>> system.time(plot(x, y, pch=1))
>   user  system elapsed
> 38.024   0.008  38.245
>> system.time(plot(x, y, pch=2))
>   user  system elapsed
> 14.140   0.027  14.270
>> system.time(plot(x, y, pch=3))
>   user  system elapsed
> 15.696   0.011  15.799
>> system.time(plot(x, y, pch=4))
>   user  system elapsed
> 18.770   0.007  18.888
> 
> This is a vanilla R session, 2.13.1 for x86_64-redhat-linux-gnu. I
> haven't tried it on any other OS, but it's making my life a lot
> smoother right now.
> 
> Sarah




With Mac OS10 (Snow Leopard, MacBookPro, R version 2.14.0), it 's a bit 
different:
2.14) 
source("/var/folders/t6/t6uCNQmsHsSw6tS6HuHp4U+++TI/-Tmp-//Rtmp4ZzIWp/file6b861d06")
[1] "plot symbol . (dot)"
   user  system elapsed 
 16.620   0.087  16.731 
[1] "plot symbol default (circle)"
   user  system elapsed 
 53.132   0.134  52.959 
[1] "symbol#  0"
   user  system elapsed 
 18.828   0.090  18.803 
[1] "symbol#  1"
   user  system elapsed 
 53.046   0.134  52.877 
[1] "symbol#  2"
   user  system elapsed 
 22.000   0.154  22.401 
[1] "symbol#  3"
   user  system elapsed 
 20.794   0.096  20.763 
[1] "symbol#  4"
   user  system elapsed 
 23.534   0.098  23.542 

It seems that even-numbered symbols are plotted faster than the odd ones

By the way, I learn a lot about R programming by just following r-help!

Best regards,


Franklin Bretschneider
--
Dept Biologie
Kruytgebouw W711
Padualaan 8
3584 CH Utrecht
The Netherlands
--
f.bretschnei...@uu.nl

__
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] tip: large plots

2011-11-18 Thread Justin Haynes
That is a function I did not know about, thanks Hadley!

I still don't see the speed increase that you do with the base plot
package, but I'm sticking with ggplot anyway!

> x<-runif(1e6)
> y<-runif(1e6)
> system.time(print(qplot(x,y)))
   user  system elapsed
 42.234   0.520  43.061
> system.time(print(qplot(x,y,pch=I('.'
   user  system elapsed
 32.370   0.204  33.868


On Fri, Nov 18, 2011 at 12:39 PM, Hadley Wickham  wrote:

> You need: system.time(print(qplot(x,y,pch=I('.'
>
> Hadley
>
> On Fri, Nov 18, 2011 at 1:30 PM, Justin Haynes  wrote:
> > Very cool.  Sadly, as far as I can tell, it doesn't work with ggplot
> though
> > :(
> >
> >
> >> x<-runif(1e6)
> >> y<-runif(1e6)
> >> system.time(plot(x,y,pch='.'))
> >   user  system elapsed
> >  0.824   0.012   0.845
> >> system.time(plot(x,y))
> >   user  system elapsed
> >  33.422   0.016  33.545
> >> system.time(print(qplot(x,y)))
> >   user  system elapsed
> >  45.142   0.228  45.687
> >> system.time(print(qplot(x,y,pch='.')))
> >   user  system elapsed
> >  47.483   1.060  49.040
> >> system.time(print(qplot(x,y,shape='.')))
> >   user  system elapsed
> >  44.807   0.689  45.710
> >
> >
> > On Fri, Nov 18, 2011 at 11:03 AM, Sarah Goslee  >wrote:
> >
> >> Hi all,
> >>
> >> I'm working with a bunch of large graphs, and stumbled across
> >> something useful. Probably many of you know this, but I didn't and so
> >> others might benefit.
> >>
> >> Using pch="." speeds up plotting considerably over using symbols.
> >>
> >> > x <- runif(100)
> >> > y <- runif(100)
> >> > system.time(plot(x, y, pch="."))
> >>   user  system elapsed
> >>  1.042   0.030   1.077
> >> > system.time(plot(x, y))
> >>   user  system elapsed
> >>  37.865   0.033  38.122
> >>
> >> If you have enough points, the result is also more legible.
> >>
> >> Choice of which pch symbol makes a difference too, the default pch=1
> being
> >> the slowest of what I tried, but "." is by far the speediest.
> >>
> >> > system.time(plot(x, y, pch=0))
> >>   user  system elapsed
> >>  11.191   0.011  11.270
> >> > system.time(plot(x, y, pch=1))
> >>   user  system elapsed
> >>  38.024   0.008  38.245
> >> > system.time(plot(x, y, pch=2))
> >>   user  system elapsed
> >>  14.140   0.027  14.270
> >> > system.time(plot(x, y, pch=3))
> >>   user  system elapsed
> >>  15.696   0.011  15.799
> >> > system.time(plot(x, y, pch=4))
> >>   user  system elapsed
> >>  18.770   0.007  18.888
> >>
> >> This is a vanilla R session, 2.13.1 for x86_64-redhat-linux-gnu. I
> >> haven't tried it on any other OS, but it's making my life a lot
> >> smoother right now.
> >>
> >> Sarah
> >>
> >> --
> >> Sarah Goslee
> >> http://www.functionaldiversity.org
> >>
> >> __
> >> 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.
> >
>
>
>
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/
>

[[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] tip: large plots

2011-11-18 Thread Hadley Wickham
You need: system.time(print(qplot(x,y,pch=I('.'

Hadley

On Fri, Nov 18, 2011 at 1:30 PM, Justin Haynes  wrote:
> Very cool.  Sadly, as far as I can tell, it doesn't work with ggplot though
> :(
>
>
>> x<-runif(1e6)
>> y<-runif(1e6)
>> system.time(plot(x,y,pch='.'))
>   user  system elapsed
>  0.824   0.012   0.845
>> system.time(plot(x,y))
>   user  system elapsed
>  33.422   0.016  33.545
>> system.time(print(qplot(x,y)))
>   user  system elapsed
>  45.142   0.228  45.687
>> system.time(print(qplot(x,y,pch='.')))
>   user  system elapsed
>  47.483   1.060  49.040
>> system.time(print(qplot(x,y,shape='.')))
>   user  system elapsed
>  44.807   0.689  45.710
>
>
> On Fri, Nov 18, 2011 at 11:03 AM, Sarah Goslee wrote:
>
>> Hi all,
>>
>> I'm working with a bunch of large graphs, and stumbled across
>> something useful. Probably many of you know this, but I didn't and so
>> others might benefit.
>>
>> Using pch="." speeds up plotting considerably over using symbols.
>>
>> > x <- runif(100)
>> > y <- runif(100)
>> > system.time(plot(x, y, pch="."))
>>   user  system elapsed
>>  1.042   0.030   1.077
>> > system.time(plot(x, y))
>>   user  system elapsed
>>  37.865   0.033  38.122
>>
>> If you have enough points, the result is also more legible.
>>
>> Choice of which pch symbol makes a difference too, the default pch=1 being
>> the slowest of what I tried, but "." is by far the speediest.
>>
>> > system.time(plot(x, y, pch=0))
>>   user  system elapsed
>>  11.191   0.011  11.270
>> > system.time(plot(x, y, pch=1))
>>   user  system elapsed
>>  38.024   0.008  38.245
>> > system.time(plot(x, y, pch=2))
>>   user  system elapsed
>>  14.140   0.027  14.270
>> > system.time(plot(x, y, pch=3))
>>   user  system elapsed
>>  15.696   0.011  15.799
>> > system.time(plot(x, y, pch=4))
>>   user  system elapsed
>>  18.770   0.007  18.888
>>
>> This is a vanilla R session, 2.13.1 for x86_64-redhat-linux-gnu. I
>> haven't tried it on any other OS, but it's making my life a lot
>> smoother right now.
>>
>> Sarah
>>
>> --
>> Sarah Goslee
>> http://www.functionaldiversity.org
>>
>> __
>> 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.
>



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

__
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] tip: large plots

2011-11-18 Thread Justin Haynes
Very cool.  Sadly, as far as I can tell, it doesn't work with ggplot though
:(


> x<-runif(1e6)
> y<-runif(1e6)
> system.time(plot(x,y,pch='.'))
   user  system elapsed
  0.824   0.012   0.845
> system.time(plot(x,y))
   user  system elapsed
 33.422   0.016  33.545
> system.time(print(qplot(x,y)))
   user  system elapsed
 45.142   0.228  45.687
> system.time(print(qplot(x,y,pch='.')))
   user  system elapsed
 47.483   1.060  49.040
> system.time(print(qplot(x,y,shape='.')))
   user  system elapsed
 44.807   0.689  45.710


On Fri, Nov 18, 2011 at 11:03 AM, Sarah Goslee wrote:

> Hi all,
>
> I'm working with a bunch of large graphs, and stumbled across
> something useful. Probably many of you know this, but I didn't and so
> others might benefit.
>
> Using pch="." speeds up plotting considerably over using symbols.
>
> > x <- runif(100)
> > y <- runif(100)
> > system.time(plot(x, y, pch="."))
>   user  system elapsed
>  1.042   0.030   1.077
> > system.time(plot(x, y))
>   user  system elapsed
>  37.865   0.033  38.122
>
> If you have enough points, the result is also more legible.
>
> Choice of which pch symbol makes a difference too, the default pch=1 being
> the slowest of what I tried, but "." is by far the speediest.
>
> > system.time(plot(x, y, pch=0))
>   user  system elapsed
>  11.191   0.011  11.270
> > system.time(plot(x, y, pch=1))
>   user  system elapsed
>  38.024   0.008  38.245
> > system.time(plot(x, y, pch=2))
>   user  system elapsed
>  14.140   0.027  14.270
> > system.time(plot(x, y, pch=3))
>   user  system elapsed
>  15.696   0.011  15.799
> > system.time(plot(x, y, pch=4))
>   user  system elapsed
>  18.770   0.007  18.888
>
> This is a vanilla R session, 2.13.1 for x86_64-redhat-linux-gnu. I
> haven't tried it on any other OS, but it's making my life a lot
> smoother right now.
>
> Sarah
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>
> __
> 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.