Question about ggplot2 compared to lattice

14 views
Skip to first unread message

Satish

unread,
Mar 4, 2009, 3:02:48 PM3/4/09
to ggplot2
Hi:
I have a question about ggplot2 compared with lattice. I am new to
both (therefore, do not have anything vested in either of them yet).
Is one suited better for certain kind of tasks compared to the other.
I do not want to cause any wars here but would like to know if I
should invest the time in one or the other?

Say, I invest the time in ggplot2, would it go waste once I want to do
something in lattice? Or, would this learning help in faster learning
of lattice? Thanks for your inputs.

I started reading the author's book on ggplot2. He seems to indicate
that ggplot2 is a more flexible design compared to lattice (according
to the book, lattice graphics lacks a formal model and this is the
advantage of ggplot2 over lattice) and he took the best of both worlds
from lattice and grid. How is it that lattice which came later (2008
compared to ggplot2 which is 2005) has an relatively more constraining
design?

Thanks.

Satish

Wayne Folta

unread,
Mar 4, 2009, 5:05:29 PM3/4/09
to Satish, ggplot2

On Wednesday, March 04, 2009, at 03:02PM, "Satish" <satish.v...@gmail.com> wrote:

>Say, I invest the time in ggplot2, would it go waste once I want to do
>something in lattice? Or, would this learning help in faster learning
>of lattice? Thanks for your inputs.

Some of the issues that I would consider:

* If you have to work with packages that provide lattice graphs, it might pay to prefer lattice.

* If you have a very programmer-ly mindset, you might prefer lattice, which is more of a "we provide the hooks for you to replace our programming with yours" kind of approach.

* If you prefer a more artistic, mix-n-match approach, ggplot2 is better.

* If you prefer to think of graphing as how you combine and modify things visually, ggplot2 is better. In contrast to the lattice approach which is more programming-like.

* If you prefer the default look of either package, and other factors are equal for you, you might go with that package.

* If you want to make graphs that don't have a straightforward description ("bar chart", "dot plot with smoothing curve", etc), ggplot2 provides more ways to plug things together to make what you want.

* If you want to grab extensions that others have made for specific graph types for specific purposes, you're much more likely to find something that is based on lattice than something that is based on ggplot2.

* Lattice will be included in any R installation that's been done in the last couple of years. GGplot2 is not guaranteed to be installed. (Though, like any R package, installation for an internet-connected machine is fairly easy.)

(Also, lattice is not as new as you seem to believe. Perhaps you're looking at the book publication date, or when it was included as a recommended R package or something else? GGplot came after lattice, and ggplot2 is a refactoring of ggplot, I'm fairly sure.)

Wayne

Satish

unread,
Mar 4, 2009, 5:10:12 PM3/4/09
to ggplot2
Hi Wayne:
Thanks for the wonderful reply. This helps me a lot.
Satish


On Mar 4, 4:05 pm, Wayne Folta <wd...@mac.com> wrote:
Reply all
Reply to author
Forward
0 new messages