Make Your Labels Legible on Mobile

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


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:


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.



Leave a Reply

Your email address will not be published. Required fields are marked *