Entering edit mode
Sim, Fraser
▴
350
@sim-fraser-2871
Last seen 10.3 years ago
Hi Robert,
I'm working with RGraphViz to plot PieGlyphs and wanted to try and add
labels to the pie slices. The Usage page describes such a use.
If I tried the following but no labels appear:
library(Rgraphviz)
plot(1:10, col="white")
pieGlyph(1:2, 5, 5, labels = c("A","B") )
****************************************
Also when I look at the function itself, it does look like it uses
'labels' at all.
function (x, xpos, ypos, labels = names(x), edges = 200, radius = 0.8,
density = NULL, angle = 45, col = NULL, border = NULL, lty = NULL,
main = NULL, ...)
{
if (!is.numeric(x) || anyis.na(x) | x <= 0))
stop("pie: `x' values must be positive.")
if (is.null(labels))
labels <- as.character(1:length(x))
x <- c(0, cumsum(x)/sum(x))
dx <- diff(x)
nx <- length(dx)
if (is.null(col))
col <- if (is.null(density))
c("lightblue", "mistyrose", "lightcyan", "lavender",
"cornsilk", "white")
else par("fg")
col <- rep(col, length.out = nx)
border <- rep(border, length.out = nx)
lty <- rep(lty, length.out = nx)
angle <- rep(angle, length.out = nx)
density <- rep(density, length.out = nx)
for (i in 1:nx) {
n <- max(2, floor(edges * dx[i]))
t2p <- 2 * pi * seq(x[i], x[i + 1], length = n)
xc <- c(cos(t2p), 0) * radius + xpos
yc <- c(sin(t2p), 0) * radius + ypos
polygon(xc, yc, density = density[i], angle = angle[i],
border = border[i], col = col[i], lty = lty[i])
}
invisible(NULL)
}
<environment: namespace:rgraphviz="">
******************************************
Here's my sessionInfo.
R version 2.8.1 (2008-12-22)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] grid stats graphics grDevices datasets utils tools
[8] methods base
other attached packages:
[1] org.Hs.eg.db_2.2.6 bioDist_1.14.0 gplots_2.6.0
[4] gdata_2.4.2 gtools_2.5.0 limma_2.16.4
[7] RColorBrewer_1.0-2 hgu133plus2.db_2.2.5 RSQLite_0.7-1
[10] DBI_0.2-4 AnnotationDbi_1.4.2 Rgraphviz_1.21.7
[13] graph_1.20.0 Biobase_2.2.1 rcom_2.0-4
[16] rscproxy_1.0-12
loaded via a namespace (and not attached):
[1] annotate_1.20.1 Category_2.8.2 cluster_1.11.12
genefilter_1.22.0
[5] GSEABase_1.4.0 KEGGgraph_0.8.15 RBGL_1.18.0 ROC_1.16.0
[9] splines_2.8.1 survival_2.34-1 XML_1.99-0
Thanks,
Fraser