Visualising categorical data with jittered plots- 2 mins
When looking at data, sometimes we want to explore the relationship between categorical data (binary, discrete, ordinal, etc). For example in the
mtcars dataset included within installations of
r, there are data of the number of cylinders (
cyl) and whether the cars are automatic (
am = 0) or manual (
am = 1).
To look at the relationship between
am, we could just do a table.
But what might be easier to visualise would be to plot out the data.
Notice that because the points all get plotted over one another, you don’t actually get to see the individual points. One way around this is to jitter the points.
We could even plot the points and add a trendline to help us see any relationships which we could then base our further exploratory analyses on.