Pie charts
The coord_polar() function converts a planar x-y Cartesian plot to polar coordinates. This can be useful if you are producing pie charts.
We can imagine two forms for pie charts - the typical filled circle, or a colored ring.
Typical pie charts omit all of the non-data ink, which we saw in the themes chapter of the last course. Pie charts are not really better than stacked bar charts, but we'll come back to this point in the next chapter.
A bar plot using mtcars of the number of cylinders (as a factor), fcyl, is shown in the console.
Deze oefening maakt deel uit van de cursus
Intermediate Data Visualization with ggplot2
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Run the code, view the plot, then update it
ggplot(mtcars, aes(x = 1, fill = fcyl)) +
geom_bar()
# Add a polar coordinate system