我有一个我要添加标签的折线图。标签有新行(\n
)。如何调整这些标签的线高?我已尝试调整text
中的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")