Posts Tagged ‘ ggplot ’

Hjust and Vjust

November 16, 2012
By
Hjust and Vjust

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 »

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

November 13, 2012
By
Can’t a plot catch a break(s)?

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 »

Add Text Annotations to ggplot2 Faceted Plot (an easier approach)

September 6, 2012
By
Add Text Annotations to ggplot2 Faceted Plot (an easier approach)

I recently posted a blog about adding text to a ggplot2 faceted plot (LINK). I was unhappy with the amount of time it takes to create the text data frame to then label the plot. And then yesterday when the … Continue reading →

Read more »

Add Text Annotations to ggplot2 Faceted Plot

August 31, 2012
By
Add Text Annotations to ggplot2 Faceted Plot

In my experience with R learners there are two basic types. The “show me the code and what it does and let me play” type and the “please give me step by step directions” type. I’ve broken the following tutorial … Continue reading →

Read more »

Horizon on ggplot2

August 27, 2012
By
Horizon on ggplot2

SocialDataBlog’s kind reference in post Horizon plots with ggplot (not) motivated me to finish what the post started.  I knew that ggplot2 would be a little more difficult to use for the purpose of a horizon plot, but I felt compelled to provide...

Read more »

Economic geography of the eastern USA circa 1999, median incomes…

August 25, 2012
By
Economic geography of the eastern USA
circa 1999, median incomes…

Economic geography of the eastern USA circa 1999, median incomes by zip code Code and data source to follow in a longer post.

Read more »

Heatmap tables with ggplot2

August 20, 2012
By
Heatmap tables with ggplot2

I wrote before about heatmap tables as a better way of producing frequency or other tables, with a solution which works nicely in latex. It is possible to do them much more easily in ggplot2, like this library(Hmisc) library(ggplot2) library(reshape) data(HairEyeColor) P=t(HairEyeColor) Pm=melt(P) ggfluctuation(Pm,type="heatmap")+geom_text(aes(label=Pm$value),colour="white")+ opts(axis.text.x=theme_text(size = 15),axis.text.y=theme_text(size = 15)) Note that ggfluctuation will also take … Continue reading...

Read more »

Horizon plots with ggplot2, sort-of

August 19, 2012
By
Horizon plots with ggplot2, sort-of

The Timely Portfolio blog via R-bloggers has recently published some interesting entries about the value of horizon plots for visual comparison of a number of time series. Very nice it looks too. You can read more about them here. The trick to understanding them is to imagine that each row was orginally a line chart … Continue reading...

Read more »

Holt-Winters forecast using ggplot2

July 16, 2012
By
Holt-Winters forecast using ggplot2

R has great support for Holt-Winter filtering and forecasting. I sometimes use this functionality, HoltWinter & predict.HoltWinter, to forecast demand figures based on historical data. Using the HoltWinter functions in R is pretty straightforward. Let's say our dataset looks as follows; demand <- ts(BJsales, start = c(2000, 1), frequency =  Read more...

Read more »

Graphics Artifacts from Quarterly Commentary

July 2, 2012
By
Graphics Artifacts from Quarterly Commentary

For my Q2 2012 commentary, I tried multiple graphs to illustrate the disconnect of the US stock markets with the rest of the world.  I think I finally settled on this simple Excel bar graph populated by Bloomberg data, but I thought some might lik...

Read more »