ggplot Visualizations Quiz 30

Test your ggplot2 skills with this 20-question multiple-choice quiz! The ggplot Visualizations Quiz covers essential topics in data visualizations in R’s ggplot2 package, including:

  • Creating basic plots (scatter plots, line plots)
  • Customizing visuals with geoms (geom_smoothgeom_text_repel)
  • Using scales (scale_color_gradientscale_color_brewer)
  • Advanced techniques like scatterplot matrices and geographic maps
Online ggplot visualizations Quiz with Answers

Whether you are a beginner or looking to refine your ggplot2 expertise, the quiz will challenge your understanding of building, customizing, and interpreting data visualizations in R. Let us start with the ggplot Visualizations Quiz now.

Online ggplot Visualizations Quiz with Answers

1. Review the code below, where variable1, variable2, and variable3 are continuous numeric variables:
ggplot(data,aes(x=variable1,y=variable2,color=variable3)+
geom_point()+
scale_color_gradient(low="blue",high="yellow")

What is scale_color_gradient telling R to do?

 
 

2. What geom is used to draw geographic borders using ggplot?

 
 
 

3. What is the aes() that you need to set in order to create a stacked area chart?

 
 
 
 

4. What structure do you need your data to be in to make a dumbbell plot?

 
 
 
 

5. What is the basic ggplot function for adding text to a plot without drawing a rectangle around the text?

 
 
 
 

6. Why would you want to use scale_color_brewer?

 
 

7. What is the value of geom_text_repel()?

 
 
 

8. What is the default method for fitting a best-fit line with geom_smooth?

 
 
 
 

9. What geom is used to place points on a map using latitude and longitude data?

 
 
 
 

10. 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 styles, one with a line for unit a and another with a line for unit b?

 
 
 

11. What does a scale do?

 
 
 

12. If you wanted to plot the points in a scatter plot but move the text label down three units, what is the correct modification?

 
 
 

13. Say you had a dataset named my_dat that summarizes the height and weight of a group of people. The first two rows look like this:

name   height   weight
Steve   6            170
Amy     5.5         140

You want a scatter plot with each person’s name at the correct x-y coordinate for height and weight. Which command is correct?

 
 
 
 

14. What is the correct geom for filling in the area underneath a line in a line plot?

 
 
 

15. What geom do you need to use to draw a Cleveland dot plot?

 
 
 

16. In the ggcorrplot() function, what is the role of the "type=" argument?

 
 
 

17. Which of these geoms is required to create a complete alluvial diagram?

 
 
 
 

18. In conjunction with ggplot and packcircles, what geoms are used to make a labelled packed circle plot?

 
 
 
 

19. Using the ggalt package, what is the geom used to draw a dumbbell chart?

 
 
 

20. What function is required to make a scatterplot matrix?

 
 
 
 

Online ggplot Visualizations Quiz with Answers

  • 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 styles, one with a line for unit a and another with a line for unit b?
  • What is the basic ggplot function for adding text to a plot without drawing a rectangle around the text?
  • Say you had a dataset named my_dat that summarizes the height and weight of a group of people. The first two rows look like this:
    name   height   weight
    Steve   6            170
    Amy     5.5         140
    You want a scatter plot with each person’s name at the correct x-y coordinate for height and weight. Which command is correct?
  • If you wanted to plot the points in a scatter plot but move the text label down three units, what is the correct modification?
  • What is the value of geom_text_repel()?
  • What does a scale do?
  • Review the code below, where variable1, variable2, and variable3 are continuous numeric variables: ggplot(data,aes(x=variable1,y=variable2,color=variable3)+ geom_point()+ scale_color_gradient(low=”blue”,high=”yellow”)
    What is scale_color_gradient telling R to do?
  • Why would you want to use scale_color_brewer?
  • What is the default method for fitting a best-fit line with geom_smooth?
  • What function is required to make a scatterplot matrix?
  • What geom do you need to use to draw a Cleveland dot plot?
  • In the ggcorrplot() function, what is the role of the “type=” argument?
  • What is the correct geom for filling in the area underneath a line in a line plot?
  • What structure do you need your data to be in to make a dumbbell plot?
  • Using the ggalt package, what is the geom used to draw a dumbbell chart?
  • What is the aes() that you need to set in order to create a stacked area chart?
  • Which of these geoms is required to create a complete alluvial diagram?
  • In conjunction with ggplot and packcircles, what geoms are used to make a labelled packed circle plot?
  • What geom is used to draw geographic borders using ggplot?
  • What geom is used to place points on a map using latitude and longitude data?

Exploratory Data Analysis Quiz

Leave a Reply

Discover more from R Programming FAQs

Subscribe now to keep reading and get access to the full archive.

Continue reading