10
The goal is to get the smoothed chart from data frame.
x <- c(1e-04, 0.0014, 0.018, 0.24, 3.2, 42, 560, 7500, 1e+05)
y <- c(0, 7, 10, 7, 0, -7, -10, -7, 0)
df <- data.frame(x, y)
The curve generated by
library(ggplot2)
ggplot(data = df, aes(x, y)) + scale_x_log10() + geom_point() + geom_line()
was connected by straight lines. How to make a smoother turn with the ggplot2?
Too reticulated? The chart is just filling the dots, connecting by lines. If you want to fit a curve into the points you have, you might want to do a polynomial regression for this case -- that’s what you’re looking for?
– elias
I used the term reticulated to express the points connected by lines. I will fix it. I think polynomial regression can solve the problem. But since I would like the curve to go through all the dots, the order of the polynomial has to be equal to the number of dots, right? With 9 points I think it works, my real case has 50 points. I will try your solution.
– Marcos Banik