{"id":21649,"date":"2023-02-06T18:52:27","date_gmt":"2023-02-06T16:52:27","guid":{"rendered":"https:\/\/www.wjst.de\/blog\/?p=21649"},"modified":"2023-02-06T19:01:49","modified_gmt":"2023-02-06T17:01:49","slug":"dpi-and-ppi-in-scientific-publications","status":"publish","type":"post","link":"https:\/\/www.wjst.de\/blog\/sciencesurf\/2023\/02\/dpi-and-ppi-in-scientific-publications\/","title":{"rendered":"DPI and PPI in scientific publications"},"content":{"rendered":"<p>It seems that also graphic design tasks are more and more shifted to the authors. A journal asked me to revise my R &#8220;figures with &gt;6 px size fonts at 600 dpi&#8221; which does not make so much sense to me as it mixes apples and oranges (DPI and PPI) and does even give me any size estimate of the final image.<\/p>\n<p>Fortunately, there is a great website <a href=\"https:\/\/archive.ph\/VlNZh\">that has a lot of helpful explanations and demo code<\/a>.<\/p>\n<p>In summary PPI are number of pixels per inch. Pixel is the smallest unit that can be displayed on a screen, the <strong>pi<\/strong>cture <strong>x<\/strong> <strong>el<\/strong>ement. So my screen has about 227 ppi which is super sharp while for historical reasons not the physical but a logical PPI of 96 is being assumed for screens.<!--more--><\/p>\n<p><a href=\"https:\/\/www.wjst.de\/blog\/wp-content\/uploads\/2023\/02\/Bildschirm\u00adfoto-2023-02-06-um-15.20.09.jpg\" data-rel=\"key-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-21650\" src=\"https:\/\/www.wjst.de\/blog\/wp-content\/uploads\/2023\/02\/Bildschirm\u00adfoto-2023-02-06-um-15.20.09.jpg\" alt=\"\" width=\"529\" height=\"131\" \/><\/a><\/p>\n<p class=\"p1\">A single pixel at 96 DPI \u00a0is equal to 0.2645835 millimeters, 0.010416675 inches or 0.75 points &#8211; the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Typographic_unit\">typographic unit<\/a> also in use by R ggplot.<\/p>\n<p>DPI in contrast\u00a0 describes the number of dots per inch eg the printing resolution of a hard copy print dot &#8211; something\u00a0 different as the DPI measurement of a printer needs to be considerably higher than the <a class=\"mw-redirect\" title=\"Pixels per inch\" href=\"https:\/\/en.wikipedia.org\/wiki\/Pixels_per_inch\">pixels per inch<\/a> (PPI) measurement of a video display in order to produce similar quality output.<\/p>\n<blockquote><p>For example, a bitmap image may measure 1,000 \u00d7 1,000 pixels, a resolution of 1 megapixel. If it is labelled as 250 PPI, that is an instruction to the printer to print it at a size of 4 \u00d7 4 inches. Changing the PPI to 100 in an image editing program would tell the printer to print it at a size of 10 \u00d7 10 inches. However, changing the PPI value would not change the size of the image in pixels which would still be 1,000 \u00d7 1,000. An image may also be resampled to change the number of pixels and therefore the size or resolution of the image, but this is quite different from simply setting a new PPI for the file.<\/p><\/blockquote>\n<p>Weird? Not so far.<\/p>\n<blockquote><p>The plot dimension is converted in inches before saving to disk, using an assumed screen DPI of 96 to make the conversion (2560 \/ 96) x (1600 \/ 96) = 26.6 x 16.6. Then ggsave uses this dimension in inches with the DPI of 300 to save it to disk, creating an image of (26.6 * 300) x (16.6 * 300) = 8000 x 5000 dots.<\/p><\/blockquote>\n<p>More general<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\"># produces 1800px x 1800px image\r\npng(width=3,height=3,units=&quot;in&quot;,res=600)<\/pre>\n<p>The difficulty comes when changing sizes is leading to different title and image text size as they seem to change at a different scale eg at points (pts, title text) and and mm\/inch (geom_text). So this is getting really weird now as changing font siz let symbols and lines shrink.<\/p>\n<p>So I would recommend to produce something visually appealing on your screen. For saving a PNG or printing <a href=\"https:\/\/www.tidyverse.org\/blog\/2020\/08\/taking-control-of-plot-scaling\/\">we need another library that does the heavy size lifting<\/a><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">library(ragg)\r\nragg::agg_png(&quot;ragg_20x20.png&quot;, width = 20, height = 20, units = &quot;in&quot;, res = 300, scaling = 2)\r\nplot(p)\r\ndev.off()\r\n<\/pre>\n<p>Saving the plot is also straightforward<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">ggsave( pngfile, p,  device = agg_png, width = 10, height = 6, units = &quot;cm&quot;, res = 300, scaling = 0.5)<\/pre>\n<p>HTH<\/p>\n\n<p>&nbsp;<\/p>\n<div class=\"bottom-note\">\n  <span class=\"mod1\">CC-BY-NC Science Surf , accessed 07.04.2026<\/span>\n <\/div>","protected":false},"excerpt":{"rendered":"<p>It seems that also graphic design tasks are more and more shifted to the authors. A journal asked me to revise my R &#8220;figures with &gt;6 px size fonts at 600 dpi&#8221; which does not make so much sense to me as it mixes apples and oranges (DPI and PPI) and does even give me &hellip; <a href=\"https:\/\/www.wjst.de\/blog\/sciencesurf\/2023\/02\/dpi-and-ppi-in-scientific-publications\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">DPI and PPI in scientific publications<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[2893,4061,4060,4062],"class_list":["post-21649","post","type-post","status-publish","format-standard","hentry","category-computer-software","tag-r","tag-dpi","tag-ggplot","tag-ppi"],"_links":{"self":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/21649","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/comments?post=21649"}],"version-history":[{"count":7,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/21649\/revisions"}],"predecessor-version":[{"id":21657,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/posts\/21649\/revisions\/21657"}],"wp:attachment":[{"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/media?parent=21649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/categories?post=21649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wjst.de\/blog\/wp-json\/wp\/v2\/tags?post=21649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}