Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205491

Dimension of the multi barplot using ggplot2 facet_wrap() in R

$
0
0

Please I wonder to send a pdf file containing the multi barplot I generated using ggplot2 / geom_bar() and facet_wrap(). It is required that the dimension of each single barplot must measure 2 cm * 2 cm (W*H). Unfortunately I didn't fid a way to do that, example if I run the example of the command line (above), it to big in an A4 paper.

I'm asking if there is a function / package / solution that allow to define the exact size of every single barplot in my future file, Any help will be much appreciated.

pdf("result.pdf" , width = 8.27 , height = 11.69) 

ggplot(mtcars, aes(x=gear,  y=mpg, fill=vs)) +  
  geom_bar(position="dodge", stat="identity") +
  facet_wrap(~ carb, ncol=2)

dev.off()

Viewing all articles
Browse latest Browse all 205491

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>