Skip to content

Drawing curves

3 messages · Allan Kamau, Greg Snow, Paul Murrell

#
Hi,
Am looking for an R package that will provide the drawing of curves and 
arcs of arbitrary shapes to use in illustrations. For example bent lines 
and arrows.

Allan.
#
Depending on what you are trying to do, there may be other tools that will work better for you.  For example xfig/jfig or Inkscape.  You can create a plot, save it to a file, load it into one of those programs and add your curves/lines/arrows/etc.

Inside of R the 'lines' function draws lines and the 'arrows' function draws arrows.  You can use the 'locator' function to find points on the graph by clicking, then pass those points to the drawing function (or use type='l' with locator to draw the line more directly).  Curves are usually approximated by many short line segments (using 'lines') or you can use the 'xspline' function to draw curves (actually the line segments).

The 'symbols' function will put some types of symbols on a plot and the 'my.symbols' function in the TeachingDemos package will place user defined symbols on the plot.

Hope this helps, if not, give a little more detail and maybe we can be of more help,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111
#
Hi
Allan Kamau wrote:
Take a look at the 'grid' package, in particular, grid.xspline(),
grid.curve(), and possibly grobX() and grobY().

There are some examples of what these can do in
http://www.stat.auckland.ac.nz/~paul/Talks/rgraphs.pdf

Paul