Skip to content
Back to formatted view

Raw Message

Message-ID: <f8e6ff050904270812u10020a8cif946270270bcdd0c@mail.gmail.com>
Date: 2009-04-27T15:12:23Z
From: Hadley Wickham
Subject: Bumps chart in R
In-Reply-To: <290f574f0904270214n639f3cd7xd3adbaa8bd085d42@mail.gmail.com>

]
> library(ggplot2)
> qplot(year,value, data=data,label=countries, geom=c("line","text"),
> group=countries, col=countries)
>
> But I would like to have the text labels show only once - e.g. at 1990
> - and also control the size of the text. In my crude qplot, setting
> size=2 e.g. changes not only the text, but also the lines etc. I guess
> I have to move from qplot to gplot.

Or just add the text layer separately:

qplot(year, value, data = data, geom = "line", group = countries) +
  geom_text(aes(label = countries), subset = .(year == 1990),
    hjust = 1, size = 3, lineheight = 1)

Hadley

-- 
http://had.co.nz/