Changing text size on a ggplot bump plot
Posted
by Tom Liptrot
on Stack Overflow
See other posts from Stack Overflow
or by Tom Liptrot
Published on 2010-06-14T16:17:30Z
Indexed on
2010/06/14
16:52 UTC
Read the original article
Hit count: 344
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())
© Stack Overflow or respective owner