How to draw an arc from one point to another using ggplot

1,293 views
Skip to first unread message

gireesh bogu

unread,
Sep 21, 2012, 4:10:47 AM9/21/12
to ggp...@googlegroups.com
Is it possible to draw something like this using ggplot ?

www.e-rna.org/r-chie/images/single.png

Brandon Hurr

unread,
Sep 21, 2012, 4:17:52 AM9/21/12
to gireesh bogu, ggp...@googlegroups.com
I'll happily be wrong, but out of the box I'm going to go with no. 

You could certainly make a plot very similar to this relying heavily on grid. Draw circles, draw x-axis, cut plot off below x-axis... 

I do question how useful this plot is though... I can't figure out what sort of data the size of the arc represents. Wider arcs seem to be more visually weighted. Whether that is good or not is dependent upon the data and what you are trying to communicate. 

On Fri, Sep 21, 2012 at 9:10 AM, gireesh bogu <girees...@gmail.com> wrote:
Is it possible to draw something like this using ggplot ?

www.e-rna.org/r-chie/images/single.png

--
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

gireesh bogu

unread,
Sep 21, 2012, 4:23:28 AM9/21/12
to ggp...@googlegroups.com, gireesh bogu
Dear Brandon,

Arc plotting, It is one of the advance method to connect complex data points. You can get a sense by looking at this plot

http://mbostock.github.com/protovis/ex/arc.html

Brandon Hurr

unread,
Sep 21, 2012, 4:31:19 AM9/21/12
to gireesh bogu, ggp...@googlegroups.com
There is a grob for doing the arcs https://svn.r-project.org/R/trunk/src/library/grid/man/grid.curve.Rd


But I don't think this has happened. 

You could spend the time to make a geom_arc().  It wouldn't be easy, but this is certainly possible. 

B

Osmo Salomaa

unread,
Sep 21, 2012, 11:19:01 AM9/21/12
to ggp...@googlegroups.com
Since those arcs seem to be half-circles, the answer to "How to draw an arc from one point to another using ggplot" is that if you know the two points you can easily (couple lines of code) generate the points to represent the arc using a sequence of angles seq(pi, 0, length.out=100) and basic trigonometry and draw them using geom_path. If you need to do some grouping or ordering of points with no natural coordinates (which your protovis link seems to imply), then it's more difficult.
Reply all
Reply to author
Forward
0 new messages