Re: smooth line

108 views
Skip to first unread message

Greg Snow

unread,
May 24, 2013, 4:47:47 PM5/24/13
to yadong xue, ggplot2
Look at the function `xspline` (or related functions in grid).  You can give `xspline` your points and the argument `draw=FALSE` and it will return a set of points that you can pass to the ggplot2 functions to get a smooth curve.  The amount of smoothness and how the points influence the curve depends on the parameters that you set.


On Fri, May 24, 2013 at 12:14 PM, yadong xue <eag...@gmail.com> wrote:
hi, there
     I just want to connect points with smoothed line, but the geom_smooth() or stat="smooth" is not what i want. what then do is not connecting points, they do a transformation. i don't want that. I just want to connected the points with smooth line just like you draw a smooth line cover all points on a paper.

    can ggplot2 do that?

--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
 
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
 
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

yadong xue

unread,
May 24, 2013, 9:31:23 PM5/24/13
to ggp...@googlegroups.com, yadong xue
ok, thank you, i'll try that.

C

unread,
May 24, 2013, 10:23:35 PM5/24/13
to yadong xue, ggp...@googlegroups.com

I was looking a way to smooth points in a line just like this...its xspline  got it

Carey Duryea

On May 24, 2013 9:31 PM, "yadong xue" <eag...@gmail.com> wrote:
ok, thank you, i'll try that.

--

saadi

unread,
May 28, 2013, 1:27:03 PM5/28/13
to ggp...@googlegroups.com, yadong xue
Respected Mr Greg,
i m a beginner in ggplot2 and unable to plot a time series by using it.my R code is 
plot=ggplot(ct,aes(x=years,start=1948,end=2011,y=y))+geom_line() 
ct is my file name which is an object of ts. R is giving an error 
Error in grid.Call.graphics(L_lines, x$x, x$y, index, x$arrow) : 
  invalid line type
please guide me how can i make this simple graph.

Gmail

unread,
May 28, 2013, 9:12:08 PM5/28/13
to saadi, ggp...@googlegroups.com
maybe you can try this script:
ggplot(data=economics,aes(x=date,y=unemploy)) + geom_line() + scale_x_date(limits=c(as.Date("1970-1-1"),as.Date("1995-1-1")))

best regards

Honglong Wu
On 29 May, 2013, at 1:24 AM, saadi <sadiachau...@gmail.com> wrote:

dear fellow,
i m a beginner in ggplot2 and unable to plot a time series by using it.my R code is 
plot=ggplot(ct,aes(x=years,start=1948,end=2011,y=y))+geom_line() 
ct is my file name which is an object of ts. R is giving an error 
Error in grid.Call.graphics(L_lines, x$x, x$y, index, x$arrow) : 
  invalid line type
please guide me how can i make this simple graph.

Reply all
Reply to author
Forward
0 new messages