ggplot2

Textual Healing Part II

November 15, 2012 | is.R()

Yesterday’s post showed a number of quick coding options for changing text in a basic ggplot. Here’s another two tricks for fine-tuning faceted plots. Again, let’s load our made up data about tooth growth (a real dataset in R, ToothGr... [Read more...]

Interactive color picker, using locator()

November 9, 2012 | is.R()

I mostly wrote this just to see how locator() works, and ended up making an HCL color picker, so you can make your own visually offensive rainbow color palettes! Or, you can make your own nice color palettes. It is up to you. Essentially, this script... [Read more...]

Five Thirty-Hate?

November 8, 2012 | is.R()

The last few days have been trying, mostly because folks keep asking me the same questions: have you voted? Who do you think will win the election? Do you think Nate Silver (http://fivethirtyeight.blogs.nytimes.com/)  is right? How confident are you ... [Read more...]

Make your own electoral map

November 7, 2012 | is.R()

You’ve already seen everyone else’s electoral map (see this amazing array of maps from 2008), how would you like to make your own? Today’s Gist allows you to do just that — input (manually!) state-by-state results, and output a... [Read more...]

Plotting letters as shapes in ggplot2

November 5, 2012 | is.R()

This post is a little more esoteric than most, but I found myself needing to solve this problem, so I’m just passing the solution on to you. The plot above shows the distribution of DW-NOMINATE scores for the 18th Congress, with party indicated ... [Read more...]

GGtutorial: Day 4 – More Colors

November 1, 2012 | is.R()

So far we’ve covered Melting and Casting data using the reshape() package and today we’re going to look at different ways of coloring and selecting palettes for plots. For these plots, we’re going to use the built in diamonds data... [Read more...]

Montreal R User Group meetup Nov. 14th

October 29, 2012 | Corey Chivers

After a bit of a summer lull, the Montreal R User Group is meeting up again! We’re trying out a new venue this time. Notman House is the home of the web in Montreal. They hold hackathons and other tech user group meetups, and they are all around great ... [Read more...]

Congressional ideology by state

October 25, 2012 | is.R()

In a recent post, I illustrated how to add a background geom to your ggplot. While that code worked, and the plot looked fine, it was pointed out to me that I was missing an important aspect of plot layering with ggplot2. Namely, it is not, as I previ... [Read more...]

Plotting the debate "Winner"

October 24, 2012 | is.R()

As a Political Scientist, it could not be more gauche to talk about the Presidential debate in terms of a winner and a loser, but the occasion provides the opportunity to show how to do (at least) three really useful things: Directly load price and v... [Read more...]

Benchmarking matrix creation

October 23, 2012 | is.R()

Sometimes it is useful to take a vector, or one column/row of a matrix, and build a new matrix of identical copies of that vector. There are lots of different ways to do this, but I just discovered a new, and very straightforward way to do this with m... [Read more...]

Distribution of colors by flag

October 22, 2012 | is.R()

A story: We showed you how to use R to assess flag similarity and make a scatter plot of raster images. Dr. Wickham referred us to the set of 2400 flag icons made available by GoSquared, and then (probably jokingly) challenged us to replicate the cool... [Read more...]

Adding a background to your ggplot

October 19, 2012 | is.R()

I really enjoy using the DW-NOMINATE data for examples, as I do here. Sometimes it’s useful to indicate regions in the background of a plot — perhaps two-dimensional regions of interest, perhaps one-dimensional periods in time. It’s... [Read more...]

Faceting as a preferable alternative to 3-D

October 18, 2012 | is.R()

Sometimes, people want to plot things in three dimensions. Others have spoken more eloquently than I could on the potential problems with plotting multiple two-dimensional relationships in a two-dimensional medium with an artificial three-dimensional ... [Read more...]

Banking to n degrees

October 15, 2012 | is.R()

As often happens, I have learned of a technique just as it is being called into question. In this case, the technique is changing the aspect ratio of a line plot such that the typical slope of each segment is 45° (see), a rule of thumb which has bee... [Read more...]

Using cairographics with ggsave()

October 12, 2012 | is.R()

Whenever possible, I try to save R graphic output in a vector format, typically pdf(). I also like to use the handy ggsave() function to do so, as it streamlines the process, and makes it easy to be consistent across formats. However, at times it is n... [Read more...]

From holey polygons to convex hulls

October 11, 2012 | is.R()

I only rarely have the occasion to need the convex hull of a set of points, but I love chull(), so I’d like to share an example of how to use it. This Gist also offers a pretty straightforward application of the Split-Apply-Combine strategy (see... [Read more...]

Simple marimekko/mosaic plots

October 10, 2012 | is.R()

I don’t really care for the name “marimekko” or “mosaic,” but I do like this type of plot as a means of illustrating proportions in nested categorical data, or as an alternative to the parallel time series plots discussed... [Read more...]

Presidential Debates with qdap-beta

October 4, 2012 | tylerrinker

qdap brief intro For the past year I’ve been working on a package (qdap) to assist my field in quantitative discourse analysis; basically looking at patterns in language. It’s still a ways from being finished and lacks documentation (roxygen2 is … Continue reading →
[Read more...]
1 2 3 11

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)