DJack
DJack

Reputation: 4940

Differences between exportation of png and pdf plots

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 version

png version

Upvotes: 3

Views: 824

Answers (1)

daroczig
daroczig

Reputation: 28672

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.

Upvotes: 8

Related Questions