3

I am attempting to use directlabels to apply labels to a lasso plot as shown here. I am able to put the labels on the page, but am unable to change the size. Passing additional arguments in a list allows me to change other elements, but not text size.

require(ggplot2)
require(directlabels)
dat_test <- data.frame(x=1:10, value=c(sin(1:10), cos(1:10), tan(1:10)), fun=rep(c('sin', 'cos', 'tan'), each=10))
p <- ggplot(dat_test, aes(x=x, y=value, group=fun, colour=fun)) + geom_line()

direct.label(p, 'last.qp') # adds labels
direct.label(p, list('last.qp', size=2)) # does not work, same as above
direct.label(p, list('last.qp', rot=30)) # correct rotates text

Is it possible to be able to change the text size of the direct label?

Sandy Muspratt
  • 31,719
  • 12
  • 116
  • 122
Erik Shilts
  • 4,389
  • 2
  • 26
  • 51

1 Answers1

8

Use:

direct.label(p, list('last.qp', cex=2)) 
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
  • Thanks, though cex=2 actually makes it bigger; cex=0.75 is just what I was looking for. I wasn't expecting base options to have that effect. Do you know if these types of options are documented somewhere? – Erik Shilts Apr 18 '12 at 20:51