Вопрос

I am trying to move my direct labels just slightly to the left, not one group but all groups. By default dl.move only moves one group at a time.

library(directlabels)
library(ggplot2)

count <- c(1,5,6,7,8,8)
year <- c(rep(c(2000,2001,2002),2))
group <- c(rep("A",3),rep("B",3))
c <- data.frame(year,count,group)

p <- ggplot(c, aes(x=year, y=count, colour=group)) + geom_line()

direct.label(p, "first.points")

I can move one point with...

kif <- dl.move("A", hjust=2, vjust=0)
direct.label(p, list("first.points",kif))

but I'd ideally just want to move the whole thing over a by the same hjust. Is there some silly syntax I've totally missed?

Это было полезно?

Решение

dl.trans(x=x-0.1) moves everything to the left 0.1cm.

direct.label(p, list(dl.trans(x=x-0.1), "first.qp"))

Другие советы

Found it. A simple

direct.label(p, list("first.points",hjust=2, vjust=0)) 

Not perfect but works, the spacing isn't uniform like default.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top