A set of examples of various graphics created with base R graphics and/or the ggplot2 package. Created as a class project by the DSA400W - Data Visualization and Communication class at Chatham University, Fall 2021.
Add explanations to diverging bar chart and separate data manipulation code and plot code into separate code blocks. This plot plots z-scores, so z-scores and the calculation used to get the z-scores should be explained. Explain the ifelse() function that calculates the new variable fertility_type and how that variable then is used in the plot to determine the fill (color) of the bars.
Also can remove ticks around 'municipality'. Ticks are used when a variable name contains spaces, but it appears that Hannah revised the example to use different data, and the different data had variable names without the spaces, so the ticks can be removed. There is also a comment that refers to mpg. That comment should be revised.
Explain why the municipality is converted to a factor, with levels set to swiss$municipality (The levels sets the order. If we don't do that the municipalities, which are the x value, will be shown alphabetically. We want them to be ordered by z score).
Finally, explain how the scale_fill_manual() function gives control over the legend in this case.
If you can't figure out all of these do as many as you can.
Add explanations to diverging bar chart and separate data manipulation code and plot code into separate code blocks. This plot plots z-scores, so z-scores and the calculation used to get the z-scores should be explained. Explain the ifelse() function that calculates the new variable fertility_type and how that variable then is used in the plot to determine the fill (color) of the bars.
Also can remove ticks around 'municipality'. Ticks are used when a variable name contains spaces, but it appears that Hannah revised the example to use different data, and the different data had variable names without the spaces, so the ticks can be removed. There is also a comment that refers to mpg. That comment should be revised.
Explain why the municipality is converted to a factor, with levels set to swiss$municipality (The levels sets the order. If we don't do that the municipalities, which are the x value, will be shown alphabetically. We want them to be ordered by z score).
Finally, explain how the scale_fill_manual() function gives control over the legend in this case.
If you can't figure out all of these do as many as you can.