Displaying 16 results from an estimated 16 matches for "nodepar".
2007 Jun 13
2
Formatted Data File Question for Clustering -Quickie Project
..."ave")
(dend1 <- as.dendrogram(hc)) # "print()" method
str(dend1) # "str()" method
str(dend1, max = 2) # only the first two sub-levels
op <- par(mfrow= c(2,2), mar = c(5,2,1,4))
plot(dend1)
## "triangle" type and show inner nodes:
plot(dend1, nodePar=list(pch = c(1,NA), cex=0.8, lab.cex = 0.8),
type = "t", center=TRUE)
plot(dend1, edgePar=list(col = 1:2, lty = 2:3), dLeaf=1, edge.root =
TRUE)
plot(dend1, nodePar=list(pch = 2:1,cex=.4*2:1, col = 2:3), horiz=TRUE)
dend2 <- cut(dend1, h=70)
plot(dend2$upper)
## leafs are wrong...
2012 Apr 30
2
Generate Dendrogram
...h R. I followed the example
shown in
http://stat.ethz.ch/R-manual/R-devel/library/stats/html/dendrogram.html
dist.obj <- as.dist(matrix.distance)
hc.obj <- hclust(dist.obj,method="ave")
dend1 <- as.dendrogram(hc.obj)
plot(hc.obj, xlab='',ylab='',sub='', nodePar=list(pch = c(1,NA),
cex=0.8, lab.cex = 0.8)).
But I got warning and the plot does not look like what I wanted.
Warning messages:
In plot.hclust(hc.obj, xlab = "", ylab = "", sub = "", nodePar =
list(pch = c(1, :
"nodePar" is not a graphical parameter...
2005 Oct 23
1
Coloring leaves, twigs and labels in plot.dendrogram()
...would be a useful feature to have....
Or is there an easier way of doing this that I have missed?
Walton Green
* * *
my.dend.plot <- function (x, type = c("rectangle", "triangle"),
center = FALSE, edge.root = is.leaf(x) || !is.null(attr(x,
"edgetext")), nodePar = NULL, edgePar = list(),
leaflab = c("perpendicular", "textlike", "none"), dLeaf = NULL,
xlab = "", ylab = "", xaxt = "n", yaxt = "s", horiz = FALSE,
frame.plot = FALSE, twig.col = NULL, lab.col = NULL, leaf.col = NU...
2004 May 10
3
Colouring hclust() trees
...our the leaves according to the
predicted group, or some other variable. The obvious thing to try is
plot(stuff.hc, col=c("red","green","blue")[stuff.predicted.group])
but that doesn't work. I read everything that seemed plausible, and
came across nodePar, but
col <- c("red","green","blue")[stuff.predicted.group]
plot(stuff.hc, nodePar=list(col=list("black",col)))
tells me repeatedly that
parameter "nodePar" couldn't be set in high-level plot() function
while
plo...
2010 Apr 13
0
Coloring leaves in Dendrogram according to gene names
...<<- function(n) {
if(is.leaf(n)) {
a <- attributes(n)
crm <- as.numeric(a$label)
gene <- as.character(bm[which(bm$CRM_ID==crm),5])
color <- as.character(gene2color[which(gene2color$genes==gene),2])
i <<- i+1
attr(n, "nodePar") <-
# c(a$nodePar, list(lab.col = my_colors[i], lab.font= i%%3))
c(a$nodePar, list(lab.col = color))
}
n
}
my_colors <- grDevices::rainbow(attr(dhc,"members"))
i <- 0
})
dL <- dendrapply(dhc, colLab)
op <- par(mfrow=2:1)
plot...
2007 Mar 09
1
dendrogram / clusteranalysis plotting
Dear all,
i performed a clusteranalysis - which worked so far...
i plotted the dendrogram and sooo many branches, a rough sketch would
be enough ;)
i tried max.levels therefore which worked, but not for the plot...
i used the following
plot(hcd,nodePar =nP, str(hcd,max.level=1))
the output on the terminal was:
--[dendrogram w/ 2 branches and 196 members at h = 2.70]
|--[dendrogram w/ 2 branches and 34 members at h = 1.79] ..
`--[dendrogram w/ 2 branches and 162 members at h = 1.95] ..
which is great !
but i cant get it done for the plot...
2011 Sep 26
0
horizontal labels for a dendrogram
...luster)
res = as.dendrogram(agnes(data))
chlab <- function(n) {
if(is.leaf(n)) {
att <- attributes(n)
labx <- data$category1[att$label]
lab_color <- ifelse(labx == "A", "black", ifelse(labx == "B", "red",
"green"))
attr(n, "nodePar") <- c(att$nodePar, lab.col = lab_color, pch = NA)
attr(n, "label") <- labx
}
n
}
# lab.col = lab_color,
res2 = dendrapply(res, chlab)
print(res2)
pdf("dendrogram.pdf",width=5,height=2.5,pointsize=8,paper='special')
par(mai=c(0.5,0.5,0.2,0.2))
plot(res2)...
2010 May 25
1
Hierarchical clustering using own distance matrices
...cript(1) were not the distances
defined in my distance matrices.
script:
var<-read.table("the distance matrix i calculated", header=TRUE, sep=" ")
var_HC<-hclust(as.dist(var),method="average")
var_dendro<-as.dendrogram(var_HC)
plot(var_dendro,ylim=c(0,5), nodePar =list(lab.cex = 0.3), header=title(" My
Distance Matrix"))
I did some research and found that the hclust function (from the hclust help
page):
"...Initially, each object is assigned to its own cluster and then the
algorithm proceeds iteratively, at each stage joining the two most...
2003 Sep 26
1
a. crossing branches with hclust, b. plot.dendrogram
Hello,
a. when I use hclust with the methods media, centroid, and mcquitty,
and plot the results, the dendrograms have lines that are crossing each
other. Is this ok?
b. My next question refers to plot.dendrogram: How can I use parameters
as "hang" or "cex" here? E.g. for
st <- as.dendrogram(subtreeshc[[x]])
I would like to have something like this, where cex and hang
2006 May 24
1
dendrogram plotting problem
Dear List
RGui Version : 2.3.0
User : 1 month
I am having the *dendrogram plotting problem *
The code i tried:
>library(cluster)
DD<-DataSetS01022 # 575 x 2 matrix
> VC<-hclust(dist(DD),"ave")
*Warning message:
NAs introduced by coercion* ( what does it mean? Is that the problem?)
> plot(VC,hang=-2)
Output: http://roughjade.blogspot.com
Can anyone guide me? Thanks
2007 Nov 29
1
coloring leaves in clustering
Hello everyone,
I wanted to know if it was possible to change the color of certain leaves in
a hclust object in order to make my graph more readable. I know I can color
certain groups but I would like to enter a vector telling the plot function
which leaves to color in which color.
Thanks in advance,
Eleni
[[alternative HTML version deleted]]
2006 Dec 26
1
Colored Dendrogram
...quot;2" 5.962963
"3" 0.473462
"4" 0.682300
R code:
hc<-hcluster(m, link="ave")
dhc<-as.dendrogram(hc)
dendrapply(dhc, function(n) str(attributes(n)))
local({
colLab <<- function(n){
if(is.leaf(n)){
a <- attributes(n)
i <<- i+1
attr(n, "nodePar") <- c(a$nodePar, list(lab.col = mycols[i], lab.font=i%%3))
}
n
}
#mycols <- grDevices::rainbow(attr(dhc,"members"))
i <- 0
})
dL <- dendrapply(dhc, colLab)
plot(dL)
-------------------------------------------------------------
On 12/26/06, r-help-request@stat.math.ethz...
2004 Oct 04
7
R 2.0.0 is released
...that names are
preserved.
o data.frame(check.names = TRUE) (the default) enforces unique
names, as S does.
o .Defunct() now has 'new' and 'package' arguments like those of
.Deprecated().
o The plot() method for "dendrogram" objects now respects many more
nodePar and edgePar settings and for edge labeling computes the
extents of the diamond more correctly.
o deparse(), dput() and dump() have a new 'control' argument to
control the level of detail when deparsing. dump() defaults to
the most detail, the others default to less. See ?.deparseO...
2004 Oct 04
7
R 2.0.0 is released
...that names are
preserved.
o data.frame(check.names = TRUE) (the default) enforces unique
names, as S does.
o .Defunct() now has 'new' and 'package' arguments like those of
.Deprecated().
o The plot() method for "dendrogram" objects now respects many more
nodePar and edgePar settings and for edge labeling computes the
extents of the diamond more correctly.
o deparse(), dput() and dump() have a new 'control' argument to
control the level of detail when deparsing. dump() defaults to
the most detail, the others default to less. See ?.deparseO...
2011 Apr 13
0
R 2.13.0 is released
...tions can now read from concatenated bzip2 files
(including files written with bzfile(open = "a")) and files
created by some other compressors (such as the example of
PR#14479).
? The primitive function c() is now of type BUILTIN.
? plot(<dendrogram>, .., nodePar=*) now obeys an optional xpd
specification (allowing clipping to be turned off completely).
? nls(algorithm="port") now shares more code with nlminb(), and is
more consistent with the other nls() algorithms in its return
value.
? xz has been updated to 5.0.1 (v...
2011 Apr 13
0
R 2.13.0 is released
...tions can now read from concatenated bzip2 files
(including files written with bzfile(open = "a")) and files
created by some other compressors (such as the example of
PR#14479).
? The primitive function c() is now of type BUILTIN.
? plot(<dendrogram>, .., nodePar=*) now obeys an optional xpd
specification (allowing clipping to be turned off completely).
? nls(algorithm="port") now shares more code with nlminb(), and is
more consistent with the other nls() algorithms in its return
value.
? xz has been updated to 5.0.1 (v...