Position in bar and col plots
Let's see how the position
argument changes geom_bar()
.
We have three position options:
stack
: The defaultdodge
: Preferredfill
: To show proportions
While we will be using geom_bar()
here, note that the function geom_col()
is just geom_bar()
where both the position
and stat
arguments are set to "identity"
. It is used when we want the heights of the bars to represent the exact values in the data.
In this exercise, you'll draw the total count of cars having a given number of cylinders (fcyl
), according to manual or automatic transmission type (fam
).
This exercise is part of the course
Introduction to Data Visualization with ggplot2
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Plot fcyl, filled by fam
___ +
# Add a bar layer
___