I have an issue with the exportation of my plots in Rstudio. The result is not the same when I export a plot in a classic image format (png, jpg...) than when I try in pdf. Differences are not very big (different places of legend, overlaying...) but it is a bit frustrating. Any ideas to solve the problem ?


pdf is a vector format where you specify e.g. the width and height of the exported plot in inches by default (7), while png is a raster image with width and height specified in pixels with optionally passed res parameter (defaults to 72).
So try to e.g. set the same dimensions for the images and change the width and height parameter of png to 7*72=504 instead of 480.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With