rstats

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

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

GGtutorial: Day 3 – Introduction to Colors

October 31, 2012 | is.R()

So, where does ggplot get its colors? If you’ve ever asked ggplot to color on the basis of a factor, you might have beeen surprised by the default color choices.  The fact is, ggplot colors factors on the basis of finding evenly spaced colors a... [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...]

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

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