Catalogues and tips for R plots
A list of plot clatalogues and tips
1 Data Visualisation
The book Fundamentals of Data Visualisation by Wilke is a good introduction to data visualisation principles. You can find the book online here: Fundamentals of Data Visualisation.
You should also check Level Up Your Labels: Tips and Tricks for Annotating Plots and Graphic design.
2 Catalogues
A list of plot catalogues. If you want to get inspired, follow these links!
3 Colour
Colour tips and palettes:
- ColorBrewer2.
- MetBrewer
- Use colour wisely.
- paleteer gallery and the paleteer package.
- Carto colors
4 Specific recommendations
- Same stats different data.
- Behind bars.
- I stopped using box plots.
- Issues with error bars.
- Visual Word Paradigm.
- Friends Don’t Let Friends Make Bad Graphs.
Some recommendations from me:
- Make sure you use the appropriate type of visualisation for different types of variables. If the variable is continuous then you can use a continuous axis, but if they are discrete (like categories or scales), you should make sure the axis is discrete and not treated as numeric (for example, you can convert a column to factor if it’s read as numeric). Some things that look numeric/continuous are in fact discrete, like scales or ratings.
- DO NOT USE BOX PLOTS: they are REALLY bad for a bunch of reasons. For a visual example, see here: https://www.autodesk.com/research/publications/same-stats-different-graphs.
- Good alternatives to box plots are strip charts and violin plots (with
geom_jitter()
andgeom_violin()
). - ONLY USE BAR CHARTS FOR COUNTS. If you are dealing with counts of stuff (money, words, gestures, phones, etc) then you can use bar charts. You will never need error bars in this case (if you feel that you could add error bars, probably you should not use bar charts). Use stacked bar charts to show proportions.
- If you have collected counts from multiple participants (adults, children, learners, etc), then you can use a strip chart to show the counts or proportion of each participant as individual points on the graph. DO NOT USE BAR CHARTS TO SHOW MEAN PROPORTIONS, see Accuracy and computing proportions.
- Connected point plots also work with time series data when you want to show individual trajectories: example
- Use colour wisely. If you need more than 4/5 different colours then perhaps you might want to reconsider using colour at all. With a lot of colours you end up with very similar colours. Also, make sure the colours you pick are colour-blind safe (https://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3).
- You can create interactive plots with plotly: for example, https://plotly.com/r/line-and-scatter/ Even interactive 3D plots: https://stefanocoretta.github.io/post/rgb-space/. Do not make static 3D plots, they are difficult to read. See Interactive plots.
- Density plots and histograms with rugs are useful to visualise a continuous variable. Rain-cloud plots too. Examples
- Make sure the plot is standalone: anybody looking at it should understand what it is about without having to read your paper/dissertation. Make clever use of axes labels, titles, subtitles, legends and so on. Enhance you plot without making it crowded.
- Check out this YT video for some data viz principles: https://youtu.be/8y9AIe-tBh4
- Check out the intRo workshop slides for some other types of plots: https://intro-rstats.github.io/intro-slides/ (more info on the workshop here https://intro-rstats.github.io).
- DO NOT USE BOX PLOTS AND USE BAR CHARTS FOR COUNTS AND RAW PROPORTIONS ONLY. (It goes without saying that you shall NEVER use a pie chart).