r - Changing height of strip text background in ggplot2 does not work as expected -


###load libraries  library(ggplot2) library(gtable)  ###build plot  d <- ggplot(mtcars, aes(x=gear)) +              geom_bar(aes(y=gear), stat="identity", position="dodge") +             facet_wrap(~cyl)  ###change height of strip text  g <- ggplotgrob(d) g$heights[[3]] = unit(2,"in") grid.newpage() grid.draw(g) 

obtained result (ggplot2_2.0.0)

enter image description here

expected result (ggplot2_1.0.1)

enter image description here

question

what in middle earth going on here?

this seems trick

g <- ggplotgrob(d) g$heights[[3]] = unit(2,"in") g$grobs[[5]]$heights <- g$grobs[[6]]$heights <-     g$grobs[[7]]$heights <- unit(1, "native") # or "npc" grid.newpage() grid.draw(g) 

enter image description here

it works if replace unit(1, "native") positive number, or true (i not sure why though - @ point coerced default type unit, "npc")


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -