Entering edit mode
3.9 years ago
Kai_Qi
▴
130
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"))
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 theggsave()
function?I run the code on Rstudio. on the right corner, there is a image, i just export it as pdf.
If you are still facing this issue, then please post on the RStudio support site:
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.