06.09.2021 Views

Learning Statistics with R - A tutorial for psychology students and other beginners, 2018a

Learning Statistics with R - A tutorial for psychology students and other beginners, 2018a

Learning Statistics with R - A tutorial for psychology students and other beginners, 2018a

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Winning Margin<br />

0 50 100 150<br />

1987 1990 1993 1996 1999 2002 2005 2008<br />

AFL season<br />

Figure 6.15: A cleaned up version of Figure 6.14. Notice that I’ve used a very minimalist design <strong>for</strong> the<br />

boxplots, so as to focus the eye on the medians. I’ve also converted the medians to solid dots, to convey a<br />

sense that year to year variation in the median should be thought of as a single coherent plot (similar to<br />

what we did when plotting the Fibonacci variable earlier). The size of outliers has been shrunk, because<br />

they aren’t actually very interesting. In contrast, I’ve added a fill colour to the boxes, to make it easier<br />

to look at the trend in the interquartile range across years.<br />

.......................................................................................................<br />

+ medlty = "blank", # no line <strong>for</strong> the medians<br />

+ medpch = 20, # instead, draw solid dots<br />

+ medlwd = 1.5 # make them larger<br />

+ )<br />

Of course, given that the comm<strong>and</strong> is that long, you might have guessed that I didn’t spend ages typing<br />

all that rubbish in over <strong>and</strong> over again. Instead, I wrote a script, which I kept tweaking until it produced<br />

the figure that I wanted. We’ll talk about scripts later in Section 8.1, but given the length of the comm<strong>and</strong><br />

I thought I’d remind you that there’s an easier way of trying out different comm<strong>and</strong>s than typing them<br />

all in over <strong>and</strong> over.<br />

6.6<br />

Scatterplots<br />

Scatterplots are a simple but effective tool <strong>for</strong> visualising data.<br />

We’ve already seen scatterplots in<br />

- 183 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!