graphics

Hjust and Vjust

November 16, 2012 | is.R()

So, when you’re setting the position of text in ggplot, you may have to use the hjust and vjust commands. Depending on your demands, and if you don’t understand what they’re doing, they might seem hard to use. I found one script that... [Read more...]

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

Textual Healing

November 14, 2012 | is.R()

While I know there are several awesome guides for how to make fine-tuning adjustments to plot labels/axes/ticks/text in ggplot, this is still the most common question I get from people new to ggplot: how do I change the size/font/color/position of (som... [Read more...]

Can’t a plot catch a break(s)?

November 13, 2012 | is.R()

This post continues with the theme of how to modify plots from within ggplot; today we will specifically looking at custom axis breaks. Plots later in the week will examine the commands to change text in the plot area. The various other shortcomings o... [Read more...]

Another look at ideology of the US congress

November 5, 2012 | David Smith

In response to last week's post on the rapidly increasing ideology of the US Republican Party, Mike Lawrence suggested another way of looking at the DW-NOMINATE ideology data. Rather than simply looking at boxplots of the congress scores by party over time, we could fit a smooth curve to get ... [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...]

Watch Obama and Romney criss-cross the US

November 1, 2012 | David Smith

The Washington Post has an interactive graphic showing the rate at which the US presidential candidates Barack Obama and Mitt Romney have visited the various states for campaign rallies and fundraisers. Here's how it looks today: You can clearly see the focus on key swing states like Florida and Ohio, ... [Read more...]

Tracking Hurricane Sandy with Open Data and R

October 29, 2012 | David Smith

Hurricane Sandy is shaping up to be a major, and very dangerous, meteorological event for the US's East coast. Naturally, everyone is looking for the latest information and forecasts. Fortunately, the wealth of public meteorological data available on the open web, combined with real-time on-the-ground updates via social media, means ... [Read more...]

Plotting correlation ellipses

October 26, 2012 | is.R()

This is an oldie but a goodie. There are a lot of ways to plot multiple bivariate relationships, but this is one of my favorites, courtesy of the R Graph Gallery. https://gist.github.com/819111 [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...]

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

Flag space: a scatter plot of raster images

October 16, 2012 | is.R()

(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 | 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...]
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)