ggplot2 plot without axes, legends, etc

后端 未结 8 1391
执念已碎
执念已碎 2020-11-28 18:23

I want to use bioconductor\'s hexbin (which I can do) to generate a plot that fills the entire (png) display region - no axes, no labels, no background, no nuthin\'.

8条回答
  •  迷失自我
    2020-11-28 18:32

    Late to the party, but might be of interest...

    I find a combination of labs and guides specification useful in many cases:

    You want nothing but a grid and a background:

    ggplot(diamonds, mapping = aes(x = clarity)) + 
      geom_bar(aes(fill = cut)) + 
      labs(x = NULL, y = NULL) + 
      guides(x = "none", y = "none")
    

    You want to only suppress the tick-mark label of one or both axes:

    ggplot(diamonds, mapping = aes(x = clarity)) + 
      geom_bar(aes(fill = cut)) + 
      guides(x = "none", y = "none")
    

提交回复
热议问题