barplot is missing in png file after saving
0
0
Entering edit mode
2.0 years ago
Kai_Qi ▴ 110

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 • 617 views
ADD COMMENT
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

Thank you. I exported it from R.

ADD REPLY
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

If you are still facing this issue, then please post on the RStudio support site:

ADD REPLY
0
Entering edit mode

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

Thanks again,

ADD REPLY
1
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 2165 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6