Increasing space between axis.title and axis.text clips the text #407

Closed
KimN opened this Issue Feb 15, 2012 · 0 comments

Comments

Projects
None yet
2 participants

KimN commented Feb 15, 2012

I described the issue in details at the Stack-exchange and hope its alright that I link to this:

http://stackoverflow.com/questions/9131916/increase-space-between-axis-title-and-axis-text-in-ggplot2-version-0-9-0

I came up with this small fix that seems to solve the issue (just a clip = "off"):

plot-render.r:64 (version commit 16e69f6)

from:

xlab_height <- grobHeight(xlabel) + 
  if (is.null(labels$x)) unit(0, "lines") else unit(0.5, "lines")
plot_table <- gtable_add_rows(plot_table, xlab_height)
plot_table <- gtable_add_grob(plot_table, xlabel, name = "xlab", 
l = panel_dim$l, r = panel_dim$r, t = -1)

ylab_width <- grobWidth(ylabel) + 
  if (is.null(labels$y)) unit(0, "lines") else unit(0.5, "lines")
plot_table <- gtable_add_cols(plot_table, ylab_width, pos = 0)
plot_table <- gtable_add_grob(plot_table, ylabel, name = "ylab",
  l = 1, b = panel_dim$b, t = panel_dim$t)

xlab_height <- grobHeight(xlabel) + 
  if (is.null(labels$x)) unit(0, "lines") else unit(0.5, "lines")
plot_table <- gtable_add_rows(plot_table, xlab_height)
plot_table <- gtable_add_grob(plot_table, xlabel, name = "xlab", 
  l = panel_dim$l, r = panel_dim$r, t = -1, clip = "off")                      <---- here

ylab_width <- grobWidth(ylabel) + 
  if (is.null(labels$y)) unit(0, "lines") else unit(0.5, "lines")
plot_table <- gtable_add_cols(plot_table, ylab_width, pos = 0)
plot_table <- gtable_add_grob(plot_table, ylabel, name = "ylab",
  l = 1, b = panel_dim$b, t = panel_dim$t, clip = "off")                     <---- here

Kind regards
Kim

hadley closed this in eac9ff8 Feb 20, 2012

@kohske kohske added a commit to kohske/ggplot2 that referenced this issue Apr 27, 2012

@hadley @kohske hadley + kohske Don't clip plot labels or legend.
Fixes #404. Fixes #407.
61f2adf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment