ggplot2 improves the graphics drawn with R. A (very) short adaptation time is needed to find how to make graphs equivalent to the ones of graphics.
For example, to draw the curve of a function, there is no function similar to
curve(). You have to use
qplot() by setting the
geom arguments as shown below.
First, the ggplot2 package must be installed.
Here, I plot the probability density function of the gamma distribution with parameters /(/alpha = 1/) and /(/beta = 1/) between 1 and 10:
require("ggplot2") qplot(1:10, stat = "function", geom = "line", fun = function(x) dgamma(x, shape = 1))
curve(dgamma(x, shape = 1), from = 1, to = 10)
The ggplot2 community is fairly active and the web searches with the keyword “ggplot2″ almost always lead to relevant results.