Back to Practice
#0108
Basic Scatter Plot in R
EasyR15 min10 XP
Problem
Given x <- c(1,2,3) and y <- c(2,4,9), write base R code to create a scatter plot with x-axis label "x" and y-axis label "y".
Why This Matters
Plotting is part of the basic R workflow for checking relationships before modeling.
Examples
Example 1
Inputx and y vectors
Outputscatter plot
plot(x, y) creates a scatter plot for numeric vectors.
Constraints
- Return the exact structure requested.
- Handle the edge cases mentioned in the prompt.
- Prefer clear logic over clever one-liners.
CodeR
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core example
Inputx and y vectors
Expectedscatter plot
plot(x, y) creates a scatter plot for numeric vectors.
Hidden Test Categories
custom titledifferent axis labelsline plot discussion