Anyway to improve the speed of ggplot2?

130 views
Skip to first unread message

Julian TszKin Chan

unread,
Jun 15, 2011, 1:05:44 AM6/15/11
to ggp...@googlegroups.com
Hi all,
I am new to ggplot2. It is a very handy tools for me to plot graph,
but the speed of it is pretty slow ( in my computer). it takes a few
second to plot a simple graph with several lines. Is there method to
improve the speed of it? or is it just the problem of my computer?
Thanks

Regards,
TszKin Julian

Saksham Chandra

unread,
Jun 15, 2011, 5:34:28 AM6/15/11
to Julian TszKin Chan, ggp...@googlegroups.com
Hi TszKin,

I am also a beginner and at present, mostly restricted to qplot(). However, I find running it on RStudio (http://www.rstudio.org/) way faster.

Best,
Saksham.


--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: http://gist.github.com/270442

To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2

James McCreight

unread,
Jun 15, 2011, 10:00:30 AM6/15/11
to Saksham Chandra, Julian TszKin Chan, ggp...@googlegroups.com
In general, it is fairly slow but most people will agree it's worth the wait. for example, once you learn to set up your data frames correctly, you'll eliminate a ton of other fussing. Personally, ggplot saves me tons of time over other graphics packages I've used because of the grammar and the high quality design. Just composing the call is fast for complex data, way faster than most other syntaxes.

I dont really know what the plans for speed improvement are... if any right now. There are certainly people on here who can comment. If I understand correctly, there may be some future code shift from proto to S3, but that is more for profiling than speed purposes??

Anyway, there are a few particular instances when it slows down and which can be avoided, in my experience:
- when there is a factor variable with many levels: move to a continuous variable.
- when computing statistics in the call to ggplot, e.g. a stat function: pre-compute your stats.

Of course, a specific example might be worth offering for any specific guidance...

James


--
-
******************************************************************************
James McCreight                               
cell: (831) 261-5149
VoIP (to cell): (720) 897-7546
Reply all
Reply to author
Forward
0 new messages