Generate the plots below showing the distribution of dog weight by breed.

Violin Plot

Make a violin plot with breed on the x-axis and weight on the y-axis. Make each breed white, 50% transparent, and outlined in a different colour, but omit the legend.

Boxplot

Make a boxplot with breed on the x-axis and weight on the y-axis. Make each breed white, 50% transparent, and outlined in a different colour, but omit the legend.

Density plot

Make a density plot with weight on the x-axis. Make each breed white, 50% transparent, and outlined in a different colour, but omit the legend.

Column Plot

Use stat_summary to create a column plot with breed on the x-axis and weight on the y-axis and error bars showing 1 standard error. Make each breed white, 50% transparent, and outlined in a different colour, but have the error bars be black. Omit the legend.

Grid

Create a grid of the violin plot, boxplot, and column plot above with all three plots on the same row. Make the figure 8 inches wide, 4 inches tall, and the image cover 100% of the width of the markdown output.

Changing defaults

For the four plots above, change the axis labels so the x-axis reads “Breed of Dog” or “Weight of Dog” (depending on the plot type) and the y-axis reads “Weight of Dog”, “Number of Dogs”, or “Density of Dogs” (depending on the plot type).

Change the default colours to “orange”, “dodgerblue”, and “hotpink”.

Add a title to each plot describing the plot type.

Save each plot as a PNG file with the names “dog_violin.png”, “dog_boxplot.png”, “dog_density.png”, and “dog_column.png” (the names are important so they show up in the code below).

Line plot

Represent the relationships among disgust subscales from the dataset reprores::disgust_scores.

Graph the linear relationship between moral and pathogen disgust. Make sure the axes run from the minimum to maximum possible scores on both axes. Give the graph an appropriate title and axis labels.

2D Density plot

If you add geom_point() to the plot above, you’ll see that there is too much data for this visualisation to make sense. Instead, create a 2d density plot of the relationship between moral and pathogen disgust for disgust_scores.

Many correlated variables

Create a heatmap of the relationships among all the questions in reprores::disgust_cors. The correlations have already been calculated for you.

Bonus: Figure out how to rotate the text on the x-axis so it’s readable.

Facets

Create a grid of plots for the reprores::stroop dataset using faceting.

Plot rt for each combination of word and ink to make a 5x5 grid of density plots. Make each plot line the same colour as the ink. For bonus points, make the lines for plots where the ink colour matches the word colour thicker than the other lines.

Advanced Grid

Create a 3x3 grid of linear line plots from disgust_scores with columns representing the x-axis and rows representing the y-axis and assign it to disgust_grid. Put a density plot of each variable along the diagonal. Make sure the graphs have appropriate titles and axis labels and that the range of the axes are the same in all graphs.

moral sexual pathogen
moral density line line
sexual line density line
pathogen line line density