Skip to content

Setting axis.ticks.length to 0 produces error #753

Closed
steveharoz opened this Issue Jan 14, 2013 · 1 comment

2 participants

@steveharoz

Sample code:

library(ggplot2)
library(grid)
theme_no_axes <- theme(
  axis.line = element_blank(), 
  axis.text.x = element_blank(), 
  axis.text.y = element_blank(),
  axis.ticks = element_blank(), 
  axis.title.x = element_blank(), 
  axis.title.y = element_blank(), 
  axis.ticks.margin = unit(c(0,0,0,0), "lines"),
  axis.ticks.length = unit(0, "mm") # BUG
  # Error in grid.Call.graphics(L_setviewport, pvp, TRUE) : 
    #Non-finite location and/or size for viewport
)

ggplot() + 
  geom_area (data=economics, aes(x = date, y = unemploy), linetype=0) +
  theme_no_axes

Setting axis.ticks.length to 0.01 fixes the problem, but it's a hack.

@wch
Collaborator
wch commented Feb 28, 2013

This is a bug in grid; see #636. It's fixed in the development version of R, so it should work in 2.15.3 and 3.0.0. The workaround for now to do exactly what you suggest: use a very small value like unit(0.01, 'mm').

@wch wch closed this Feb 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.