I get an error that seems to be combined using annotation_logticks()and coord_flip()on the same site. For example:
ggplot(mtcars, aes(x=mpg, y=disp)) +
geom_line() +
annotation_logticks(sides="l") +
coord_flip()
gives an error Error in unit(yticks$y, "native") : 'x' and 'units' must have length > 0. traceback()gives results that I don’t quite understand, but which seem to have something to do with unit assignment.
On the other hand, it only annotation_logticks()or coord_flip()does not cause any problems.
ggplot(mtcars, aes(x=mpg, y=disp)) +
geom_line() +
annotation_logticks(sides="l")
works fine, like
ggplot(mtcars, aes(x=mpg, y=disp)) +
geom_line() +
#annotation_logticks(sides="l")
coord_flip()
I could switch the displays xand yto avoid coord_flip(), but this is not ideal (I need to rewrite the old graphs if I want to add annotation_logticks(), for example).
source
share