tags:

views:

223

answers:

1

Hi,

I'm fairly new to ggplot. I have made a bumpplot using code posted below. I got the code from someones blog - i've lost the link....

I want to be able to increase the size of the lables (here letters which care very small on the left and right of the plot) without affecting the width of the lines (this will only really make sense after you have run the code)

I have tried changing the size paramater but that always alter the line width as well.

Any suggestion appreciated.

Tom

require(ggplot2)
df<-matrix(rnorm(520), 5, 10) #makes a random example
colnames(df) <- letters[1:10] 
Price.Rank<-t(apply(df, 1, rank))
dfm<-melt(Price.Rank)
names(dfm)<-c( "Date","Brand", "value")
p <- ggplot(dfm, aes(factor(Date), value,
 group = Brand, colour = Brand, label = Brand))
p1 <- p + geom_line(aes(size=2.2, alpha=0.7)) + 
    geom_text(data = subset(dfm, Date == 1), aes(x = Date , size =2.2, hjust =      1, vjust=0)) + 
    geom_text(data = subset(dfm, Date == 5), aes(x = Date , size =2.2, hjust =  0, vjust=0))+
    theme_bw() + 
    opts(legend.position = "none",  panel.border = theme_blank()) 

p1 + theme_bw() + opts(legend.position = "none",  panel.border = theme_blank())
+3  A: 

Try this

  geom_text(data=subset(dfm, Date == 1), aes(x=Date),
            size=12, hjust=1, vjust=0) +
  geom_text(data=subset(dfm, Date == 5), aes(x=Date),
            size=20, hjust=0, vjust=0)

i.e., set the size outside of the aes mapping.

rcs
Thanks, that worked. I need to spend a bit of time learing ggplot.
Tom Liptrot