The command you suggested serves the purpose to some extent But I am still looking for a command/function to give smoother curves. I am giving a reproducible code below which is drawing rather sharp edges or more crudely: the line joining the points is too sharp especially at the moment it starts from one point to another. Sorry for non-technical language as I am still unfamiliar with the field. Thanks for the help provided on this issue. Please suggest the modifications in the code below to get smoother curves.
xdata1<-c(6:11)
ydata1<-c(-0.75132894, -1.71909555, -0.62653171, 0.49512191, 0.29201836, 0.31094460)
plot(NULL,NULL,xlim=xlims,ylim=ylims,axes=FALSE, ann=FALSE)
axis(1,cex.axis=0.7,mgp=c(3, .3, 0))
axis(2, las=1,cex.axis=0.7,at=c(-2,-1,0,1,2), mgp=c(3, .7, 0))
mtext(side = 1, text =expression('Year'), line = 1,font=15)
mtext(side = 2, text = expression('Variable'), line = 1.5,font=15)
lines(smooth.spline(xdata1,ydata1, df=5), col='red',type="l", pch=22, lty=1, lwd=1)
#######Updated Query Finishes Here
I have to plot very small magnitude data against time steps of 1. Please see the sample data below:
xdata<-c(1:48)
ydata<- c(0.325563413,0.401913414,0.221939845,0.19881055,
-0.05918293,-1.108143815,-0.220563332,-0.148715078,
-0.14998762,0.131610695,0.249923598,0.246891873,
0.656812019,0.524436114,0.23875397,0.200695075,
-0.015974087,-0.611863249,0.121994831,-0.143103421,
-0.142109609,0.101451935,0.160242421,0.232404601,
0.348305745,0.231109382,0.334988321,0.263046902,-0.058154333,
-1.032276818,-0.352068888,-0.13082767,-0.134611511,0.116967421,
0.268706409,0.232776855,0.39515544,0.540317537,0.424281195,
0.3061158,-0.210735495,0.023705618,0.473338271,0.270527033,
-0.165394174,0.268773501,0.202437269,0.305577906)
Please help me in plotting a smooth line without highlighting individual points for the data.
Thanks in advance,