This is a test version of Biostars. For the public version, visit https://www.biostars.org.
barplot is missing in png file after saving

Dear all:

I am using ggplot to do a barplot for geneOntology in R. The output is fine. However, I can only see the labeling of the bar in the saved png file. But if I saved it as pdf all the content is shown .

How should I adjust the size of the image.

My code is:

p <- ggplot(data=mydata_3, aes(x=Term, y=logPValue), size =1) +
  geom_bar(position = 'dodge', stat='identity', fill = "red") +
  geom_text(aes(x = Term, y = logPValue,label=Count), hjust = -0.5, size = 3, inherit.aes = TRUE)

p + coord_flip() + theme_bw() +
  theme(
    panel.border = element_blank(), panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(), axis.line = element_line(colour = "black"))
rna-seq r software error next-gen gene

I see no code related to png/pdf, please add this.

Thank you. I exported it from R.

Sorry, what? How are you saving as pdf? Are you using the pdf(); ... dev.off() method or the ggsave() function?

I run the code on Rstudio. on the right corner, there is a image, i just export it as pdf.

OK. Thank you. dev.off enable me to get the file.

Thanks again,

Yes, obviously, but which code? Or did you do it by clicking in RStudio?

Right. I did not have code. I ran it in Rstudio.

You should use ggsave. It will give you a lot more control than using RStudio. Even in Rstudio export, you should be able to specify plot dimensions.

0 answers

No answers yet.

Log in to answer this question.