{"id":400788,"date":"2026-04-25T08:00:00","date_gmt":"2026-04-25T14:00:00","guid":{"rendered":"https:\/\/www.seascapemodels.org\/posts\/2026-04-23-clear-plots-ggplot-for-mobile\/"},"modified":"2026-04-25T08:00:00","modified_gmt":"2026-04-25T14:00:00","slug":"design-your-plots-ggplot-for-mobile","status":"publish","type":"post","link":"https:\/\/www.r-bloggers.com\/2026\/04\/design-your-plots-ggplot-for-mobile\/","title":{"rendered":"Design your plots (ggplot) for mobile"},"content":{"rendered":"<!-- \r\n<div style=\"min-height: 30px;\">\r\n[social4i size=\"small\" align=\"align-left\"]\r\n<\/div>\r\n-->\r\n\r\n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;\">\r\n[This article was first published on  <strong><a href=\"https:\/\/www.seascapemodels.org\/posts\/2026-04-23-clear-plots-ggplot-for-mobile\/\"> Seascapemodels<\/a><\/strong>, and kindly contributed to <a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers<\/a>].  (You can report issue about the content on this page <a href=\"https:\/\/www.r-bloggers.com\/contact-us\/\">here<\/a>)\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>\n \n\n\n\n\n\n<p>The default for styling plots should be for easy viewing on mobile devices.<\/p>\n<p>Most digital interactions are via mobile these days. Even if you plan on viewing your plots on a desktop, a mobile friendly layout will make them more readable.<\/p>\n<p>I recommend defaulting to a mobile friendly view from day 1 of data exploration. This means using larger font, line and label sizes than standard plotting package defaults. I\u2019ll show how below.<\/p>\n<p>You can then alter the styling as your finalize the plots of publication, where desktop viewing might be more common (I saw \u2018might be\u2019 because I frequently papers on my phone these days).<\/p>\n<p>Styling plots for visual clarity is key from the start, because clarity of presentation influences how you interpret the research. So it has a tangible impact on the way your research will develop and how you engage with your collaborators.<\/p>\n<p>I often communicate with collaborators and students via instant messages (e.g.\u00a0Teams), which allows for quick feedback cycles. The default ggplot settings can be hard to view however.<\/p>\n<p>There are many good books on making graphs, e.g.\u00a0check out the Functional Art by Alberto Cairo.<\/p>\n<p>Below I just want to show a few tips for improving ggplot2 settings to get better visuals for mobile.<\/p>\n<p>We\u2019ll use one of my <a href=\"https:\/\/github.com\/cbrown5\/example-ecological-data\" rel=\"nofollow\" target=\"_blank\">example datasets<\/a> from an <a href=\"https:\/\/doi.org\/10.1098\/rspb.2022.0348\" rel=\"nofollow\" target=\"_blank\">algal growth experiment<\/a>.<\/p>\n<p>You can load it directly from the url.<\/p>\n<p>The biggest tip is to change the base size in your base theme. If you do this with <code>theme_set<\/code> it then applies to all plots in this R session.<\/p>\n<pre>library(tidyverse)\r\n# Read raw data\ndat &lt;- read.csv(&quot;https:\/\/raw.githubusercontent.com\/cbrown5\/example-ecological-data\/main\/data\/algal-stressors\/diuron_data.csv&quot;)\n\ntheme_set(theme_bw(base_size = 28))\n\nggplot(dat) + \n    aes(x = hours, y = celld) + \n    geom_point(alpha = 0.5) +\n    labs(x = &quot;Hours&quot;, y = &quot;Cell density&quot;)\r\nWarning: Removed 75 rows containing missing values or values outside the scale range\n(`geom_point()`).<\/pre>\n<p><img src=\"https:\/\/i0.wp.com\/www.seascapemodels.org\/posts\/2026-04-23-clear-plots-ggplot-for-mobile\/index.markdown_strict_files\/figure-markdown_strict\/unnamed-chunk-1-1.png?w=578&#038;ssl=1\" class=\"img-fluid\" data-recalc-dims=\"1\"><\/p>\n<p>Second tip is to keep facts to 3 or so panels.<\/p>\n<p>Before:<\/p>\n<pre>ggplot(dat) + \n    aes(x = hours, y = celld) + \n    geom_point(alpha = 0.5) + \n    facet_grid(Diuron_num~Light_num) +\n    labs(x = &quot;Hours&quot;, y = &quot;Cell density&quot;)<\/pre>\n<p><img src=\"https:\/\/i1.wp.com\/www.seascapemodels.org\/posts\/2026-04-23-clear-plots-ggplot-for-mobile\/index.markdown_strict_files\/figure-markdown_strict\/unnamed-chunk-2-1.png?w=578&#038;ssl=1\" class=\"img-fluid\" data-recalc-dims=\"1\"><\/p>\n<p>Better:<\/p>\n<pre>dat |&gt;\n    filter(Diuron_num == 1) |&gt;\n    ggplot() +\n    aes(x = hours, y = celld) + \n    geom_point(alpha = 0.5) + \n    facet_wrap(.~Light_num) + \n    labs(x = &quot;Hours&quot;, y = &quot;Cell density&quot;, title = &quot;Diuron = 1&quot;)<\/pre>\n<p><img src=\"https:\/\/i2.wp.com\/www.seascapemodels.org\/posts\/2026-04-23-clear-plots-ggplot-for-mobile\/index.markdown_strict_files\/figure-markdown_strict\/unnamed-chunk-3-1.png?w=578&#038;ssl=1\" class=\"img-fluid\" data-recalc-dims=\"1\"><\/p>\n<p>Best: for mobile ,use a vertical arrangement<\/p>\n<pre>dat |&gt;\n    filter(Diuron_num == 1) |&gt;\n    ggplot() +\n    aes(x = hours, y = celld) + \n    geom_point(alpha = 0.5) + \n    facet_grid(Light_num~.) + \n    labs(x = &quot;Hours&quot;, y = &quot;Cell density&quot;, title = &quot;Diuron = 1&quot;)<\/pre>\n<p><img src=\"https:\/\/i1.wp.com\/www.seascapemodels.org\/posts\/2026-04-23-clear-plots-ggplot-for-mobile\/index.markdown_strict_files\/figure-markdown_strict\/unnamed-chunk-4-1.png?w=578&#038;ssl=1\" class=\"img-fluid\" data-recalc-dims=\"1\"><\/p>\n<p>In general, don\u2019t put too much information on a single plot. If you are using colours avoid lengthy legends (<7 items is ideal, <3 is excellent).<\/p>\n<p>If its getting too complex, think about what you are trying to communicate, then split your plot into several plots, one for each point.<\/p>\n<p>Finally, you might as well set-up to save publication quality pngs from the get go:<\/p>\n<pre>g1 &lt;- dat |&gt;\n    filter(Diuron_num == 1) |&gt;\n    ggplot() +\n    aes(x = hours, y = celld) + \n    geom_point(alpha = 0.5) + \n    facet_grid(Light_num~.) + \n    labs(x = &quot;Hours&quot;, y = &quot;Cell density&quot;, title = &quot;Diuron = 1&quot;)\nggsave(g1, filename = &quot;figure1.png&quot;, width = 6, height = 12, dpi = 600)<\/pre>\n<p>Play around with width and height to get the viewing ratio and size good for clear visualisation. A high dpi is needed for publication quality images.<\/p>\n\n\n\n \n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;\">\r\n<div style=\"text-align: center;\">To <strong>leave a comment<\/strong> for the author, please follow the link and comment on their blog: <strong><a href=\"https:\/\/www.seascapemodels.org\/posts\/2026-04-23-clear-plots-ggplot-for-mobile\/\"> Seascapemodels<\/a><\/strong>.<\/div>\r\n<hr \/>\r\n<a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers.com<\/a> offers <strong><a href=\"https:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=RBloggers\" rel=\"nofollow\">daily e-mail updates<\/a><\/strong> about <a title=\"The R Project for Statistical Computing\" href=\"https:\/\/www.r-project.org\/\" rel=\"nofollow\">R<\/a> news and tutorials about <a title=\"R tutorials\" href=\"https:\/\/www.r-bloggers.com\/how-to-learn-r-2\/\" rel=\"nofollow\">learning R<\/a> and many other topics. <a title=\"Data science jobs\" href=\"https:\/\/www.r-users.com\/\" rel=\"nofollow\">Click here if you're looking to post or find an R\/data-science job<\/a>.\r\n\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>","protected":false},"excerpt":{"rendered":"<div style = \"width:60%; display: inline-block; float:left; \">\n<p>The default for styling plots should be for easy viewing on mobile devices.<br \/>\nMost digital interactions are via mobile these days. Even if you plan on viewing your plots on a desktop, a mobile friendly layout will make them more readable.<br \/>\nI recomm&#8230;<\/p><\/div>\n<div style = \"width: 40%; display: inline-block; float:right;\"><\/div>\n<div style=\"clear: both;\"><\/div>\n","protected":false},"author":3083,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"aioseo_notices":[],"jetpack-related-posts":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/400788"}],"collection":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/users\/3083"}],"replies":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/comments?post=400788"}],"version-history":[{"count":1,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/400788\/revisions"}],"predecessor-version":[{"id":400789,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/400788\/revisions\/400789"}],"wp:attachment":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/media?parent=400788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/categories?post=400788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/tags?post=400788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}