Learn R Programming

Homeric (version 0.1-3)

PlotDoughnut: Plot doughnut

Description

Plot values as a doughnut.

Usage

PlotDoughnut( values, clockwise=TRUE, origin.degrees=0, radius=1, thickness=0.5, frame.plot=FALSE, xlim=c(-radius, radius), ylim=c(-radius, radius), col=NULL, n=2500, centre.text=NULL, centre.cex=par('cex'), centre.col='black', labels=names(values), labels.cex=par('cex'), labels.col='black', labels.radius=radius-thickness/2, to.degrees=360, ...)

Arguments

values
values to be plotted.
clockwise
if TRUE values are plotted clockwise.
origin.degrees
clockwise number of degrees, starting at 12 o'clock, at which the first value is plotted.
radius
radius of the outside of the doughnut.
thickness
thickness of the doughnut.
frame.plot
if TRUE a frame is drawn.
xlim
the x limits of the plot.
ylim
the y limits of the plot.
col
colours of the segments.
n
number of points that make up the inside and outside of the circles.
centre.text
text to be plotted inside the doughnut.
centre.cex
character expansion factor of the centre text.
centre.col
colour of the centre text.
labels
labels to be plotted within each.
labels.cex
character expansion factor of the labels.
labels.col
colour of the labels.
labels.radius
radius at which labels will be plotted.
to.degrees
a value of 360 plots a complete doughnut; 180 plots half a doughnut.
...
other values to be passed to plotting functions.

Details

Plots `values' in a doughnut. `PlotDonut` is a synonym for `PlotDoughnut`.

Examples

Run this code
# Six presentations of the same data
v <- c(25, 25, 12.5, 12.5, 25)
names(v) <- LETTERS[1:length(v)]
par(mfrow=c(2, 3), mar=c(0, 0, 0, 0), oma=c(0, 0, 5, 0))
PlotDoughnut(v, centre.text='Doughnut')
PlotDoughnut(v, centre.text='Counter-clockwise', clockwise=FALSE)
PlotDoughnut(v, centre.text=~Origin~at~90^o, origin.degrees=90)
PlotDoughnut(v, centre.text='Half nut', to.degrees=180, origin=-90)
PlotDoughnut(v, centre.text='Side nut', to.degrees=180, origin=0)
PlotDoughnut(v, centre.text='Taken a bite', to.degrees=270, origin=-45,
    clockwise=FALSE, thickness=0.1)
title(main='You doughnut', outer=TRUE, cex.main=3)

Run the code above in your browser using DataLab