Looping over variables in ggplot

You just need to use aes_string instead of aes, like this:

ggplot(data=t, aes_string(x = "w", y = i)) + geom_line() 

Note that w then needs to be specified as a string, too.

Leave a Comment