我有一个要添加标签的折线图。标签有新行 ( \n
)。如何调整这些标签的行高?我试过调整text
in theme
,但没有明显效果。(在这种情况下,我希望减少行高)。
library(ggplot2)
library(directlabels)
tx <- time(mdeaths)
Time <- ISOdate(floor(tx),round(tx%%1 * 12)+1,1,0,0,0)
uk.lung <- rbind(data.frame(Time,sex="male\n(men)",deaths=as.integer(mdeaths)),
data.frame(Time,sex="female\n(women)",deaths=as.integer(fdeaths)))
p <- qplot(Time,deaths,data=uk.lung,colour=sex,geom="line")+
xlim(ISOdate(1973,9,1),ISOdate(1980,4,1)) +
theme(text = element_text(lineheight = 0.5)) # this seems to have no effect
direct.label(p,"last.points")