wilkelab / ggtext

Improved text rendering support for ggplot2
https://wilkelab.org/ggtext/
GNU General Public License v2.0
655 stars 37 forks source link

Unable to run README example #21

Closed mattwarkentin closed 4 years ago

mattwarkentin commented 4 years ago

Tried to run the following code from the README examples and get an error.

library(cowplot)

ggplot(mpg, aes(cty, hwy)) + 
  geom_point() +
  facet_wrap(~class) +
  theme_half_open(12) +
  background_grid() +
  theme(
    strip.background = element_blank(),
    strip.text = element_textbox(
      size = 12,
      color = "white", fill = "#5D729D", box.color = "#4A618C",
      halign = 0.5, linetype = 1, r = unit(5, "pt"), width = unit(1, "npc"),
      padding = margin(2, 0, 1, 0), margin = margin(3, 3, 3, 3)
    )
  )
Error in unit(rep(just$hjust, n), "npc") : 
  'x' and 'units' must have length > 0
In addition: Warning messages:
1: In e1[n] <- e2[n] :
  number of items to replace is not a multiple of replacement length
2: In numnotnull("lineheight") : NAs introduced by coercion

Any thoughts on why?

clauswilke commented 4 years ago

Please see #13.