Test your ggplot() function in R skills with this interactive ggplot2 data visualization quiz! Perfect for R users. The ggplot2 Data Visualization Quiz covers key ggplot2 concepts, syntax, and best practices. See how well you know ggplot2—take the challenge now!” Let us start with the ggplot2 Data Visualization Quiz now.
Online ggplot2 Data Visualization Quiz
Online ggplot2 Data Visualization Quiz with Answers
- Which of these is NOT a component of a ggplot figure?
- What is facetting?
- What is the first argument in the ggplot() function in R?
- What kind of data would be the best candidate for scatter plotting?
- Say you had data saved to an object in R named “my_data” that looked like this:
Height Weight Gender
5 120 Male
5.5 130 Female
and so on.
What is the correct ggplot() command for creating a scatter plot with weight on the x-axis, height on the y-axis, and the changing the color of the point based on gender? - What does it mean to set the aesthetic mappings in ggplot?
- Say you have data saved to the my_data object that looks like this:
City State Population
(categorical) (categorical) (numeric values)
Which of these will draw a histogram for cities in the state of California? - Say you have data saved to the my_data object that looks like this:
City State Population
(categorical) (categorical) (numeric values)
Which of these will draw a boxplot of the population for cities in California? - Say you have data saved to the my_data object that looks like this:
City State Population
(categorical) (categorical) (numeric values)
Which of these will draw a density plot of the population for cities in California? - What can you do if you have a problem with overplotting in a scatter plot?
- What does it mean to modify the binning of a histogram?
- How do you modify a ggplot() command to tell R to make a bar plot?
- What is the difference between using geom_bar() and geom_bar(stat=”identity”)?
- Say you had a plot that you started with this ggplot() function in R. Assume that variable1 and variable2 are categorical variables. ggplot(my_data,aes(x=variable1,fill=variable2)) What do you add to create a stacked barplot, so counts of different values of variable2 “stack” up to equal the sum of counts for the different values of variable1?
- Say you had a plot that you started with this ggplot() function in R. Assume that variable1 and variable2 are categorical variables. ggplot(my_data,aes(x=variable1,fill=variable2)) What do you add to create a grouped barplot, so counts of different values of variable2 are grouped by values of variable1?
- Let’s say you drew a bar plot where the bars were filled with colors based on some value in the data. R will automatically generate a legend. Which of these is the correct way to remove the legend?
- Say you are starting with a ggplot() command that looks like this, ggplot(my_data,aes(y=variable1,x=time)) where variable1 is a continuous numeric variable and time is a set of years from 1999 to 2000. You want a line plot that tracks the value of variable1 across these years. What do you add to draw the line that will connect variable1 values across years?
- Say you have data that looks like this, saved to the object my_dat:
time unit value
1 a 5
1 b 10
2 a 6
2 b 9
3 a 7
3 b 8
Which is a correct series of functions for creating a line plot with time on the x-axis, value on the y-axis, and two different lines on the same plot for unit a and unit b? - Say you have data that looks like this, saved to the object my_dat:
time unit value
1 a 5
1 b 10
2 a 6
2 b 9
3 a 7
3 b 8
Which is the correct series of functions for creating a line plot with time on the x-axis, value on the y-axis, and two different lines with different colors on the same plot for unit a and unit b? - Say you have data that looks like this, saved to the object my_dat:
time unit value
1 a 5
1 b 10
2 a 6
2 b 9
3 a 7
3 b 8
Which is the correct series of functions for creating a line plot with time on the x-axis, value on the y-axis, and two different plots, one with a line for unit a and another with a line for unit b?