I never got a response from pcalg's maintainer, so I thought I'd publisher a patch here that allows you to specify optional node-labels; when no labels are specified, `plot' falls back on the default behaviour of labelling nodes sequentially.
diff -Naur pcalg-orig/R/pcalg.R pcalg/R/pcalg.R --- pcalg-orig/R/pcalg.R 2007-03-22 03:20:49.000000000 -0700 +++ pcalg/R/pcalg.R 2007-11-26 00:07:24.000000000 -0800 @@ -292,14 +292,25 @@ }) setMethod("plot", signature(x = "pcAlgo"), - function(x, y, main = NULL, zvalue.lwd = FALSE, lwd.max = 7, ...) + function(x, y, main = NULL, zvalue.lwd = FALSE, lwd.max = 7, + labels = NULL, ...) { if(is.null(main)) main <- deparse([EMAIL PROTECTED]) + attrs <- list() + nodeAttrs <- list() + if (!is.null(labels)) { + attrs$node <- list(shape = "ellipse", fixedsize = FALSE) + names(labels) <- nodes([EMAIL PROTECTED]) + nodeAttrs$label <- labels + } if (zvalue.lwd & numEdges([EMAIL PROTECTED])!=0) { lwd.Matrix <- [EMAIL PROTECTED] lwd.Matrix <- ceiling(lwd.max*lwd.Matrix/max(lwd.Matrix)) - z <- agopen([EMAIL PROTECTED],name="lwdGraph") + z <- agopen([EMAIL PROTECTED], + name="lwdGraph", + nodeAttrs = nodeAttrs, + attrs = attrs) eLength <- length([EMAIL PROTECTED]) for (i in 1:eLength) { x <- as.numeric([EMAIL PROTECTED]@head) @@ -308,7 +319,8 @@ } plot(z, main = main, ...) } else { - plot([EMAIL PROTECTED], main = main, ...) + plot([EMAIL PROTECTED], nodeAttrs = nodeAttrs, main = main, + attrs = attrs, ...) } })
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel