Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (5.3k points)

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'.

1 Answer

0 votes
by

You can use the element_blank() argument function to remove axes, legends, labels, etc,

For example:

library("ggplot2")

data(mtcars)

p <- ggplot(mtcars, aes(x=hp, y=mpg)) + 

  geom_point(alpha=0.6) 

p <- p + 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(),

          legend.position="none",

          panel.background = element_rect(fill = "transparent",colour = NA),

          panel.border=element_blank(),

          panel.grid.major=element_blank(),

          panel.grid.minor=element_blank(),

          plot.background = element_rect(fill = "transparent",colour = NA))

png('tr41.png',width=300, height=300,units="px")

print(p)

dev.off()

Output:

image

Related questions

Browse Categories

...