library(ggplot2)
data <- data.frame(
x = seq(-4, 2, by = 0.04), # Range nilai x
y = sapply(seq(-4, 2, by = 0.04), function(x) x^2) # Fungsi f(x) = x^2
)
plot <- ggplot(data, aes(x, y)) +
geom_line() +
labs(title = "Slice Plot: f(x) = x^2", x = "x", y = "f(x)")
print(plot)