Skip to content

R for Journalists

Unlock the power of R

  • What Is R?
  • R for Rob
  • GitHub
  • Twitter
  • Etsy
  • Home
  • 2016
  • October
  • 1
  • Make Your Labels Legible on Mobile

Make Your Labels Legible on Mobile

Posted on October 1, 2016October 2, 2016 By Rob
See

In my previous post, I showed how poorer children are more likely to be fat.

ncmp_v5

Think about how your graphics look on a mobile phone before you publish them.

I didn’t do this properly with my last post – I published it first and then checked how it looked on mobile.

That isn’t the best approach – and it won’t be necessary now that I can edit this site through my mobile phone using WordPress’s Jetpack feature. (I’ve also settled the overall theme of the site for now too, which helps).

The code in R that I used to format my chart reads like this (with scales and ggplot2 packages installed):

+ labs(y = "% in each weight class", 
 x = "Schools in more deprived areas ->", size = 4) 
+ ggtitle("How Poor Children Are More Likely To Be Fat") 
+ scale_y_continuous(labels = scales::percent)
+theme(axis.title = element_text(size=34),
axis.text = element_text(size = 18),
 plot.title = element_text(size = 44),
 legend.title = element_text(size = 28),
 legend.text = element_text(size = 20))

Those last lines with element_text controls text size. This is very important because if your axes are too small on mobile, it’s too difficult to understand.

Here’s how it looked first time round: on mobile, with smaller settings:

screenshot_2016-10-01-11-23-25

Not bad, but those axes are too small. Here is how it looks after some tinkering with the element_text to make the various text bigger:

Much better.

 

 

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook

Related

Tags: dataviz ggplot2 journalism mobile readability rstats tinkering

Post navigation

❮ Previous Post: How Poor Children Are More Likely To Be Fat
Next Post: Visualising the Boom in New Flats in Manchester ❯

Recent Posts

  • I’ve moved my blog over to Substack
  • How to plot a large rural area using Ordnance Survey data in R
  • Check the COVID-19 vaccination progress in your area
  • Let R tell you what to watch on Netflix
  • Sentiment analysis of Nineteen-Eighty-Four: how gloomy is George Orwell’s dystopian novel?

Archives

  • April 2022
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • February 2020
  • December 2019
  • November 2019
  • October 2019
  • April 2018
  • March 2018
  • January 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • September 2016

Categories

  • Geospatial data
  • Landmark Atlas
  • Learn
  • See
  • Seen Elsewhere
  • Site
  • Uncategorized

Copyright © 2025 R for Journalists.

Theme: Oceanly by ScriptsTown

 

Loading Comments...