Question: barplot is missing in png file after saving
0
gravatar for Kai_Qi
9 months ago by
Kai_Qi100
Chicago, IL
Kai_Qi100 wrote:

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"))
ADD COMMENTlink modified 8 months ago by Biostar ♦♦ 20 • written 9 months ago by Kai_Qi100
1

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

ADD REPLYlink written 9 months ago by ATpoint46k

Thank you. I exported it from R.

ADD REPLYlink written 9 months ago by Kai_Qi100
1

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

ADD REPLYlink written 9 months ago by Ram32k

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

ADD REPLYlink written 9 months ago by Kai_Qi100

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

ADD REPLYlink written 8 months ago by Kevin Blighe71k

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

Thanks again,

ADD REPLYlink written 8 months ago by Kai_Qi100
1

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

ADD REPLYlink modified 9 months ago • written 9 months ago by ATpoint46k

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

ADD REPLYlink written 9 months ago by Kai_Qi100
1

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 REPLYlink written 9 months ago by Ram32k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1613 users visited in the last hour
_