Pages (Desktop)

Pages (Mobile)

Quick guide to pch symbols in R

R pch symbols

A quick guide to pch symbols in R, including: which symbols are available, how to use them in plots and how to style them by changing colours, size, and line widths.

A handy reference for pch!

Quick guide to line types (lty) in R

A quick guide to the different line types that are available to use in R, and how to use them. This guide will also show you how to create your own line type, and additionally covers line end styles (lend) and line join styles (ljoin).

A handy reference for lty, lend and ljoin!

Principal Components Analysis (PCA) in R

There is no shortage of ways to do principal components analysis (PCA) in R. Many packages offer functions for calculating and plotting PCA, with additional options not available in the base R installation. R offers two functions for doing PCA: princomp() and prcomp(), while plots can be visualised using the biplot() function. However, the plots produced by biplot() are often hard to read and the function lacks many of the options commonly available for customising plots.

This guide will show you how to do principal components analysis in R using prcomp(), and how to create beautiful looking biplots using R's base functionality, giving you total control over their appearance. I'll also show you how to add 95% confidence ellipses to the biplot using the "ellipse" package.

PhD thesis by publication: Thoughts and experiences

For anyone thinking about embarking on a PhD, or has recently started the journey, a common question that arises is what format will you choose to publish your thesis? Do you go down the "traditional" route, writing a monolithic piece of text, or opt for the "thesis by publication" route (also known as alternative format, or article thesis), where you publish journal articles "as you go".

What option you choose may ultimately result from what question you trying to answer, the subject you are doing, or by the options offered by your university. Your future career choice may also dictate the type of thesis you write. Thinking of an academic career? then "publish or perish" may sound familiar to you!

Having recently completed my PhD thesis by publication, I wanted to share my thoughts and experiences on this format. Admittedly, before I started my PhD, I hadn't even thought about the different options for the thesis, but it seemed like a no brainer to do it via publications. After all, no one will ever read it, right?

Pollen diagrams in R using rioja - Part 3

In the third part of this guide series, which looks at plotting pollen diagrams using the "rioja" package, I will show you how you can combine different plot styles into a single pollen diagram figure. Now, your pollen diagram (or other stratigraphic diagram) could consist of bar plots, line plots and/or silhouette plots, rather than just a single plot type...

Secure https connection now enabled for this blog

Hi all, just a quick message to say that secure https connections have been enabled on this blog. The blog is hosted on with a custom domain name, previously it was not possible to enable https using custom domains. However, a recent update (still in beta) has made this possible. All visitors should automatically be redirected to the secure web page. This may result in some broken links - please let me know if you come across any. Thanks!

Creating multi-panel plots and figures using layout()

Multi-panel plots and figures are used everywhere, especially in scientific papers to compare different graphs or datasets. And creating them has never been easier using R!

There are several functions and ways in which you can create multi-panel plots/figures, and in this guide I will show you how to use the layout() function (available in the base installation) to create them.

Pollen diagrams in R using rioja - Part 2

In the second part of this guide series, I will show you some additional options and "hacks" that you can use for plotting pollen diagrams using the "rioja" package in R.

Click read more for full details, and a step by step guide.

Pollen diagrams in R using rioja - Part 1

If you have ever needed to create a pollen or stratigraphic diagram, you'll know there are various ways to do this. And of course, it can be done in R! In this two-part guide series I will show you how to plot a pollen diagram using the "rioja" package in R. You can also use this guide to create other stratigraphic diagrams, for example, diatom diagrams. Read on for more...

RasterStacks and raster::plot

Following on from the previous guide looking at WorldClim data, in this guide I take a look at using RasterStacks to import WorldClim datasets. In the previous guide, we used RasterLayers to import the data, so what is the difference? A RasterStack is a collection of RasterLayers bundled together, or stacked into one object. If you're only dealing with a few RasterLayers, then a RasterStack might not be necessary. However, when the number of RasterLayers increase, it can be easier to work with RasterStacks.

For example, if you wanted to look at minimum, maximum, and mean temperature data, along with precipitation data from WorldClim, using RasterLayers would require you to create 48 separate objects. Using a RasterStack, you could instead create 4 objects containing all the data for each variable.

This guide will also take a look at some of the additional options you have when plotting RasterStacks and other raster objects. Did you know that when you plot a raster object in R using plot(), it actually invokes the raster::plot function, while standard objects (e.g. scatterplots) would invoke graphics::plot? The previous guide suggested you might want to plot a figure which includes separate plots for each month of the year, or you might want a minimum and maximum temperature plot? I'll show you how you can do this easily using RasterStacks and raster::plot.