R: What are the pros and cons of using Lattice versus ggplot2?

R: What are the pros and cons of using Lattice versus ggplot2?


Love what Roger Peng said when comparing Base/Lattice/gglot2 packages in his ppt: https://github.com/rdpeng/CourseraLectures/blob/master/ggplot2_part1.pptx

  1. “Artist’s palette” model
  2. Start with blank canvas and build up from there
  3. Start with plot function (or similar)
  4. Use annotation functions to add/modify (text, lines, points, axis)


Convenient, mirrors how we think of building plots and analyzing data


  1. Can’t go back once plot has started (i.e. to adjust margins);
  2. need to plan in advance
  3. Difficult to “translate” to others once a new plot has been created (no graphical “language”). Plot is just a series of R commands

Plots are created with a single function call (xyplot, bwplot, etc.)


  1. Most useful for conditioning types of plots: Looking at how y changes with x across levels of z
  2. Thinks like margins/spacing set automatically because entire plot is specified at once
  3. Good for putting many many plots on a screen


  1. Sometimes awkward to specify an entire plot in a single function call
  2. Annotation in plot is not intuitive
  3. Use of panel functions and subscripts difficult to wield and requires intense preparation
  4. Cannot “add” to the plot once it’s created


  1. Split the difference between base and lattice
  2. Automatically deals with spacing, text, titles but also allows you to annotate by “adding”
  3. Superficial similarity to lattice but generally easier/more intuitive to use
  4. Default mode makes many choices for you (but you can customize!)

This is summarized very nicely in a set of blog posts on the Learn R blog.

ggplot2 currently does not support true 3d surfaces, according to this post:

ggplot2 Version of Figures in “Lattice: Multivariate Data Visualization with R”

Need Your Help

How to reduce the number of if-else statements in PHP?

php nested readability if-statement

I found that there are many if-else statements, especially nested if else statements, these statements make my code less readable. How to reduce the number of if else statements in PHP?

How to check if collection exists in MongoDB using C# driver?

c# mongodb mongodb-.net-driver

Is there any way in C# to check if a collection with a specific name already exists in my MongoDB database?