jjplot: Yet another plotting library for R

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!

Advertisement

6 Comments

Filed under Uncategorized

6 responses to “jjplot: Yet another plotting library for R

  1. Neat! I’ll look forward to seeing more about it.

  2. Pingback: Somethink to Chew On » ggplot and concepts — what’s right, and what’s wrong

  3. Paul

    Any chance of a version that will iinstall
    in MS windows ?

  4. 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

    • 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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s