[R] Circular plot

David L Carlson dcarlson at tamu.edu
Mon Feb 13 18:52:53 CET 2017

You can do this easily with the DrawCircle() function in package DescTools. It is easiest to use geometric coordinates (0 is at 3 o'clock and moves counterclockwise around the circle), but it could be converted to 12 o'clock and clockwise:


# Convert begin/stop to radians
dat$begin <- 0 + 2 * pi * dat$start/1500
dat$stop <- 0 + 2 * pi * dat$end/1500

# Open blank plot window and draw circles
Canvas(xlim = c(-5,5), xpd=TRUE)
DrawCircle (r.out = 5, r.in = 5, theta.1=.05, theta.2=2*pi-.05, lwd=3)
with(dat, DrawCircle(r.out = 5 - score/5, r.in = 5 - score/5, 
     theta.1=begin, theta.2=stop, border=col, lwd=4))
text(5.2, .4, "1", pos=4)
text(5.2, -.4, "1500", pos=4)

David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352

-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of swaraj basu
Sent: Monday, February 13, 2017 10:34 AM
To: r-help at r-project.org
Subject: [R] Circular plot

I want to plot segments deleted from mitochondrial DNA of patients with
neuromuscular disorders. I generate the plot on a linear chromosome using a
code similar to as shown below


segments(dat$start, dat$score, dat$end, dat$score, col=dat$col, lwd=3)

Since the human mitochondria is a circular genome, I would like to
visualise the plot generated above as a circle where all segments with
positive score lie inside the circle and those with negative score lie
outside. Attached is a representation of my requirement, although here it
is manually drawn. Can someone help me on this?

Swaraj Basu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mtDNAplot.png
Type: image/png
Size: 5241 bytes
Desc: mtDNAplot.png
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20170213/1ca44fe5/attachment.png>

More information about the R-help mailing list