Those of you who follow this blog know that making (somewhat) pretty plots is an abiding interest of mine. Many of the plots I’ve made in the past were done using the great ggplot2 package. But recently Eytan Bakshy and I have been tinkering with our own plotting library, jjplot, as a playground for various ideas we’ve had. As the name indicates, it is heavily inspired by hadley’s library. Our library doesn’t do quite as much as ggplot2, and ours is liable to be much buggier. But it’s still fun to play with. Here are some examples of what jjplot can do:
- Bar plots with fills controlled by the values.
df <- data.frame(x = 1:50, y = rnorm(50))
jjplot(x, y, data = df, fill = y, jjplot.bar(col = "black"))
- Boxplots.
df <- data.frame(state = rownames(state.x77), region = state.region, state.x77)
jjplot(region, Income, data = df, fill = region, jjplot.group(jjplot.quantile(), by = region), jjplot.box())
- Scatter plot, colored by factor, with alpha blending. This also demonstrates how statistics can be used to visualize different aspects of the data simultaneously.
df <- data.frame(x = rnorm(10000) + (1:4) * 1, f = factor(c('A', 'B', 'C', 'D')))
df$y <- c(-6, -2, 2, 4) * df$x + rnorm(10000)
jjplot(x + 2, y, data = df, alpha = 0.10, color = f, jjplot.point(), jjplot.group(jjplot.fit(), by = f), jjplot.abline(), jjplot.fun.y(mean), jjplot.hline(lty = "dashed"))
- An example of log scales and the CCDF statistic.
df <- data.frame(x=rlnorm(1000,2,2.5))
jjplot(x, data = df, jjplot.ccdf(density=TRUE), jjplot.point(), log='xy')
Lots more demos and documentation are here. To install visit http://jjplot.googlecode.com/files/jjplot_1.0.tar.gz and install the downloaded package using
R CMD INSTALL jjplot_1.0.tar.gz
We’re eager to hear your feedback!
6 Comments
March 7, 2010 at 5:06 pm
Neat! I’ll look forward to seeing more about it.
March 7, 2010 at 9:52 pm
[...] like to conclude this overlong rant with two notes. First, just today a new graphics package for R was introduced. jjplot uses many of the ideas of the Grammar of Graphics and ggplot2, but seems to avoid at least [...]
March 13, 2010 at 3:02 am
Any chance of a version that will iinstall
in MS windows ?
March 13, 2010 at 3:24 am
Soon! Stay tuned!
August 18, 2010 at 5:56 pm
You need to pick one of the project hosting pages for jjplot and make it the main one. googling “jjplot” gets this blogpost, which seems to be outdated now, as I understand people should now install from the R-Forge repository… https://r-forge.r-project.org/R/?group_id=835
August 18, 2010 at 6:40 pm
Thanks for pointing that out. I’ve moved the project to r-forge because of the conveniences it offers vis a vis packaging. An new post is forthcoming with updated pointers and a description of some new features.