I am struggling with plotting a figure on the motion profile of a simulator. What I'm trying to show are the displacements of the simulator over time.
Some sample data:
Time = c(0, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44)
Displacement = c(0, 0, 7, 0, 0, 7, 0, 0, -7, 0, 0)
DD = as.data.frame(Time, Displacement)
I want to plot a curved/smoothed line that goes directly through these datapoints.
enter image description here Using geom_line off course generates a spiky line.
The closest I have gotten to get a smoother line is using this piece of code:
ggplot(DD, aes(x=Time, y=Displacement, c(0,7))) +
geom_smooth(method = "loess", se = FALSE, span = 0.2, colour="black")
enter image description here However, the curves are still quite spiky and I am hoping to get a more beautiful plot.
Hoping anyone can be of help:) Anne
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.