Showing posts with label ggplot. Show all posts
Showing posts with label ggplot. Show all posts

Tuesday, November 22, 2011

Webscrapping baby names


This exercise in webscraping and plotting with ggplot, courtesy of the Command-Line Worldview blog, reminds me of the chapter in Freakanomics where these discuss trends in -- and trendy -- baby names.

Monday, November 7, 2011

R and batman

As if R and ggplot weren't cool enough, you can now draw the Batman symbol using code from a Chinese bioinformatician's blog. Another reason R is cooler than SAS.

Tuesday, October 25, 2011

The Learning R Blog

The Learning R blog has some great examples for using ggplot. In particular, the blog details how to make plots from the book(1) on the lattice package with ggplot.

(1) Lattice: Multivariate Data Visualization

Thursday, October 20, 2011

Making basic plots with qplot( ) in the ggplot2 package


The package qqplot2 offers a lot of improvements over the basic plot() function in R. The basic syntax is luckily not that different than plot().

A qplot statement looks like this:

qplot(xaxis, yaxis, data = dataframe, geom = "point", color = category, xlab = "label", ylab = "label", main = "title")

So, a plot statement could look like

qplot(mass, offspring, data = reproduction, geom = "point", color = plot)

geom can take on several things:
geom = "line"
geom = c("point", "smooth") => a scatter plot with a smoothing spline
geom ="histogram" => standard histogram
geom = "density" => a smooth distribution curve instead of a histogram

Graphs with multiple panels are created by including "facets = "