leeper / slopegraph

Edward Tufte-Inspired Slopegraphs
187 stars 21 forks source link

Plot.new() needed for ggslopegraph? #17

Closed bshor closed 7 years ago

bshor commented 7 years ago

I'm using ggslopegraph() exclusively because of how awesome it looks and how great ggplot2 is. But when I call ggslopegraph() initially I get the following error:

Error in strwidth(sprintf(fmt, long[["value"]])) : 
  plot.new has not been called yet

While invoking plot.new() works, this should not be necessary, right? I've never needed to call it for any other ggplot2 methods.

leeper commented 7 years ago

Looks like a but. I think it's here: https://github.com/leeper/slopegraph/blob/master/R/ggslopegraph.R#L138. Probably the strwidth() function (because nothing has been plotted at that point). I'll try to fix.