Posts Tagged ‘ graphics ’

Congressional ideology by state

October 25, 2012
By
Congressional ideology by state

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 »

Distribution of colors by flag

October 22, 2012
By
Distribution of colors by flag

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
By
Adding a background to your ggplot

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 »

The rapidly increasing ideology of the US Republican Party

October 18, 2012
By
The rapidly increasing ideology of the US Republican Party

The chart below comes by way of the is.R blog and shows the average ideology of the members of the United State House of Representatives within the Republican (red) and Democratic (blue) parties. (Other parties are shown in green.) The chart is shown as a time series, from the first US congress in 1789, to the most recent full...

Read more »

Faceting as a preferable alternative to 3-D

October 18, 2012
By
Faceting as a preferable alternative to 3-D

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 »

The distribution of ideology in the U.S. House (with plyr)

October 17, 2012
By
The distribution of ideology in the U.S. House (with plyr)

This Gist has a couple of things going on, I’ll just list them: It downloads the entire history of U.S. House DW-NOMINATE scores from voteview.com It evaluates aggregate statistics, with members grouped by party and congress, with easy weighted ...

Read more »

Flag space: a scatter plot of raster images

October 16, 2012
By
Flag space: a scatter plot of raster images

(Click for a bigger version) I’m not sure when plotting raster images in an R scatter plot will end up being useful. It’s not something I expect to need to do in my day-to-day research, and I think in general probably adds more complexity ...

Read more »

Banking to n degrees

October 15, 2012
By
Banking to n degrees

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
By
Using cairographics with ggsave()

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
By
From holey polygons to convex hulls

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 »