ggplot2 plot without axes, legends, etc

后端 未结 8 1390
执念已碎
执念已碎 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:44

    I didn't find this solution here. It removes all of it using the cowplot package:

    library(cowplot)
    
    p + theme_nothing() +
    theme(legend.position="none") +
    scale_x_continuous(expand=c(0,0)) +
    scale_y_continuous(expand=c(0,0)) +
    labs(x = NULL, y = NULL)
    

    Just noticed that the same thing can be accomplished using theme.void() like this:

    p + theme_void() +
    theme(legend.position="none") +
    scale_x_continuous(expand=c(0,0)) +
    scale_y_continuous(expand=c(0,0)) +
    labs(x = NULL, y = NULL)
    

提交回复
热议问题