[R] Bumps chart in R
achristoffersen at gmail.com
Thu May 7 12:21:41 CEST 2009
On Thu, May 7, 2009 at 2:15 AM, Mike Lawrence <Mike.Lawrence at dal.ca> wrote:
> (cross posting to the ggplot2 group for posterity)
> Here's how I'd approach it:
> text = letters[1:20]
> tal1 = rnorm (20,5,2)
> tal2 = rnorm (20,6,3)
> dif = tal2-tal1
> df0 = data.frame(text,tal1,tal2)
> df = melt(
> data = df0
> , id.vars = 'text'
> , variable_name = 'tal'
> df$dif = dif
> df$col = ifelse(dif>0,'red',ifelse(dif<0,'blue','black'))
> df$size = abs(dif)
> # draw the plot
> Unfortunately it's not perfect:
> (1) col isn't being interpreted literally, so instead of truly red & blue.
> (2) the lines ends are square whereas usually they're rounded.
> (3) attempting to remove the legend via opts(legend.position="none")
> seems to fail.
with your melted data I was able to come very close to what I want.
legen.posistion="none" works for me... Annonying that colours don't
work like expected... It seams to be a frequent concern.
from time to time", ylab = "Points")+
theme_bw()+ opts(legend.position="none")+ opts(title="As time went
More information about the R-help