Challenge - 5 Problems
Professional Visualizer
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this ggplot2 customization?
Consider the following R code using ggplot2. What will be the color of the points in the plot?
R Programming
library(ggplot2) data <- data.frame(x = 1:3, y = c(3, 2, 4)) ggplot(data, aes(x, y)) + geom_point(color = "blue")
Attempts:
2 left
💡 Hint
Look at the color argument inside geom_point.
✗ Incorrect
The color argument inside geom_point sets the color of the points. Here it is set to "blue", so points will be blue.
🧠 Conceptual
intermediate1:30remaining
Why does customizing axis labels improve professionalism?
Why is it important to customize axis labels in a visualization?
Attempts:
2 left
💡 Hint
Think about how labels guide the viewer.
✗ Incorrect
Custom axis labels clearly describe what each axis shows, making the visualization easier to understand and more professional.
🔧 Debug
advanced2:30remaining
Identify the error in this R plot customization
This code tries to change the plot title font size but causes an error. What is the error?
R Programming
library(ggplot2) data <- data.frame(x = 1:3, y = c(3, 2, 4)) ggplot(data, aes(x, y)) + geom_point() + ggtitle("My Plot") + theme(plot.title = element_text(size = "large"))
Attempts:
2 left
💡 Hint
Check the type of the size argument in element_text.
✗ Incorrect
The size argument in element_text() must be a number, not a string. Using "large" causes an error.
🚀 Application
advanced2:00remaining
How to customize legend position in ggplot2?
You want to move the legend to the bottom of the plot. Which code snippet does this correctly?
R Programming
library(ggplot2) data <- data.frame(x = 1:3, y = c(3, 2, 4), group = c("A", "B", "A")) ggplot(data, aes(x, y, color = group)) + geom_point() + ???
Attempts:
2 left
💡 Hint
legend.position expects a string like "bottom".
✗ Incorrect
The correct way to move the legend is theme(legend.position = "bottom"). Other options are invalid syntax.
❓ Predict Output
expert3:00remaining
What is the output of this customized plot code?
What will be the color of the bars in this bar plot?
R Programming
library(ggplot2) data <- data.frame(category = c("A", "B"), value = c(5, 7)) ggplot(data, aes(x = category, y = value, fill = category)) + geom_bar(stat = "identity") + scale_fill_manual(values = c("A" = "red", "B" = "blue"))
Attempts:
2 left
💡 Hint
Check the scale_fill_manual mapping of colors to categories.
✗ Incorrect
scale_fill_manual assigns red to category A and blue to category B, so bars are colored accordingly.