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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

type = ’p’<br />

type = ’o’<br />

type = ’h’<br />

type = ’l’<br />

type = ’b’<br />

type = ’s’<br />

Figure 6.5: Changing the type of the plot.<br />

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

• type = "o". Draw the line overthetopofthepoints.<br />

• type = "b". Drawboth points <strong>and</strong> lines, but don’t overplot.<br />

• type = "h". Draw“histogram-like” vertical bars.<br />

• type = "s". Drawastaircase, going horizontally then vertically.<br />

• type = "S". DrawaStaircase, going vertically then horizontally.<br />

• type = "c". Draw only the connecting lines from the “b” version.<br />

• type = "n". Draw nothing. (Apparently this is useful sometimes?)<br />

The simplest way to illustrate what each of these really looks like is just to draw them. To that end,<br />

Figure 6.5 shows the same Fibonacci data, drawn using six different types of plot. As you can see, by<br />

altering the type argument you can get a qualitatively different appearance to your plot. In <strong>other</strong> words,<br />

as far as R is concerned, the only difference between a scatterplot (like the ones we drew in Section 5.7)<br />

<strong>and</strong> a line plot is that you draw a scatterplot by setting type = "p" <strong>and</strong> you draw a line plot by setting<br />

type = "l". However, that doesn’t imply that you should think of them as begin equivalent to each <strong>other</strong>.<br />

As you can see by looking at Figure 6.5, a line plot implies that there is some notion of continuity from<br />

one point to the next, whereas a scatterplot does not.<br />

- 165 -

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

Saved successfully!

Ooh no, something went wrong!