2

I have some trouble changing the format of my line labels (colour and size). Can somebody point me in the right direction?

colnames(dfm) = c("date", "portfolio", "return")
p1<- ggplot(dfm) +
  geom_line(aes(x = date, y = return, color = portfolio)) +
  geom_dl(aes(x = date, y = return, label = "portfolio"), method = "last.bumpup", size = 0.01, color = portfolio) +
  geom_hline(yintercept = 100, linetype = "dashed", color = "blue", size = 0.02) +
  theme_classic()
gt1 <- ggplotGrob(p1)
gt1$layout$clip[gt1$layout$name == "panel"] <- "off"
grid.draw(gt1)

current plot

Changing the size parameter does not seem to alter the size of the directlabels.

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
incognito
  • 25
  • 4
  • Possible duplicate of [this question](https://stackoverflow.com/questions/13242436/label-size-in-directlabels-geom-dl). – Arienrhod Aug 28 '19 at 11:32
  • You should always add a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). Otherwise, it's hard to help you. – Arienrhod Aug 28 '19 at 11:33
  • Possible duplicate of [Label size in directlabels geom\_dl()](https://stackoverflow.com/questions/13242436/label-size-in-directlabels-geom-dl) – Arienrhod Aug 28 '19 at 11:40

1 Answers1

1

As mentioned here, formatting options go inside of a list given to the method argument.

Arienrhod
  • 2,451
  • 1
  • 11
  • 19