Category Archive
The following is a list of all entries from the Plotting category.
Plotting in Grids
Filed in Plotting, R, Statistics, Visualization, December 29, 2009, 9:03 pmThis is post #12 in a running series about plotting in R.
I regularly find myself wanting to show arrays or grids of plots in R. This is straightforward using par and mfrow as long as you want a symmetric, evenly spaced grid of plots. Unfortunately, this often is not what I [...]
Shading Pieces of an R Plot
Filed in Plotting, R, Visualization, August 11, 2009, 6:25 pmThis is post #11 in a running series about plotting in R.
I often want to shade pieces of an R plot, in order to visually draw out some piece, such as weekends or recessions. Let’s look at how to do that with the plain plotting tools.
First, I have some obscured data from [...]
Filled Line Plots / Graphs in R — Part 10 in a Series
Filed in Plotting, R, Visualization, July 28, 2009, 1:16 amThis is post #10 in a running series about plotting in R.
Otherwise known as filled curves.
Say you want to, instead of drawing a single line, draw a filled curve. R’s basic plot doesn’t make the especially easy, though it can be made much easier with packages such as ggplot2 as we’ll see [...]
Multiple Y Axes in R Plots — Part 9 in a Series
Filed in Plotting, R, Visualization, July 20, 2009, 9:00 amThis is post #09 in a running series about plotting in R.
Frequently, you want to plot data that is not at all on the same scale. In R, this is done via plotting a second graph on top of your first and building the axes labels by hand. Here’s a rough [...]
Visualizing and Comparing Distributions — Part 8 of a Series
Filed in Plotting, R, Statistics, Visualization, July 13, 2009, 2:16 pmThis is post #08 in a running series about plotting in R.
Last time, I talked about visualizing the Uniform, Normal, Exponential, and Poisson Distributions. However, there are more useful methods than just plotting the density and distribution functions.
Of course, you can always simply ask R to output summary statistics:
> n [...]
Multiple Plots and Visualizing Distributions – Part 7 in a Series
Filed in Plotting, R, Statistics, Visualization, July 12, 2009, 7:50 pmThis is post #07 in a running series about plotting in R.
I was helping a friend plot some interesting distributions this weekend, so I decided to use distributions to demonstrate one of the neater bits of R’s basic plotting tools: the ability to easily combine plots into a single plot.
par will allow you [...]
Labeling Plots – Annotations, Legends, etc — Part 6 in a Series
Filed in Plotting, R, Visualization, July 10, 2009, 4:44 pmThis is post #06 in a running series about plotting in R.
You regularly want to label pieces of a plot in order to point a particular feature out or answer a question that your audience will have. Let’s see how to do this in R.
First, let’s collapse all the R source we [...]
Plotting With Custom X Axis Labels in R — Part 5 in a Series
Filed in Data Munging, Plotting, R, Visualization, July 7, 2009, 3:03 amThis is post #05 in a running series about plotting in R.
There are a variety of ways to control how R creates x and y axis labels for plots. Let’s walk through the typical process of creating good labels for our YHOO stock price close plot (see part 4).
Reviewing our plot from [...]
Plotting Multiple Series in R — Part 4 in a Series
Filed in Data Munging, Plotting, R, July 5, 2009, 9:00 amThis is post #04 in a running series about plotting in R.
Frequently, you want to simultaneously plot multiple series on the same plot. Let’s try plotting daily observations along with a 30 day moving average.
To start, I have observations for YHOO stock from 12 April 1996 through 2 July 2009.
First, the data [...]
Comparing Many Variables in R with Plots — Part 3 in a Series
Filed in Plotting, R, Visualization, July 4, 2009, 9:00 amThis is post #03 in a running series about plotting in R.
Say you have a data frame with a number of variables that you would like to compare against each other. While you could plot them all on the same graph, statisticians frequently wish to look for visual evidence of correlation between [...]