How do you create a bar plot in ggplot2 for a categorical variable named category and its counts?
A. geom_bar(x = category, y = count)
B. geom_bar(mapping = aes(x = category, y = count))
C. geom_bar(aes(x = category, y = count))
D. bar_plot(category, count)
Answer: Option C
In ggplot2, what function is used to create a scatter plot?
A. geom_scatter()
B. scatter()
C. geom_point()
D. point()
How do you change the color of all points in a ggplot2 scatter plot to red?
A. color = "red"
B. fill = "red"
C. col = "red"
D. aes(color = "red")
In ggplot2, what is the purpose of the aes() function?
A. Adds aesthetic mappings to the plot
B. Adjusts the axis labels and titles
C. Applies statistical transformations to the data
D. Sets the color of the entire plot
What is the purpose of the ggtitle() function in ggplot2?
A. Sets the title of the entire plot
B. Adds a title to a specific layer of the plot
C. Adds a title to the legend
D. Adjusts the size of the title text
Join The Discussion