An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111010/8f5ae111/attachment.pl>
Type of Graph to use
9 messages · Jurgens de Bruin, jim holtman, Gabor Grothendieck +1 more
See if this gives you the presentation you want:
x <- read.table(textConnection("Name Class
a Class1
a Class4
b Class2
b Class1
d Class3
d Class5
e Class4
e Class2"), header = TRUE)
closeAllConnections()
# add columns of numeric values of factors
x$name <- as.integer(x$Name)
x$class <- as.integer(x$Class)
# create plot area
plot(0
, type = 'n'
, xaxt = 'n'
, yaxt = 'n'
, xlab = ''
, ylab = ''
, xlim = c(0, max(x$class))
, ylim = c(0, max(x$name))
)
# now plot the rectangles
rect(
xleft = x$class - 1
, ybottom = x$name - 1
, xright = x$class
, ytop = x$name
, col = x$name
)
# add the labels
axis(1
, at = seq(0.5, by = 1, length = length(levels(x$Class)))
, labels = levels(x$Class)
)
axis(2
, at = seq(0.5, by = 1, length = length(levels(x$Name)))
, labels = levels(x$Name)
)
On Mon, Oct 10, 2011 at 6:49 AM, Jurgens de Bruin <debruinjj at gmail.com> wrote:
Hi, Please advice on what type of graph can be used to display the following data set. I have the following: Name ? ?Class a ? ? ? ? ? ? Class 1 a ? ? ? ? ? ? Class4 b ? ? ? ? ? ? Class2 b ? ? ? ? ? ? Class1 d ? ? ? ? ? ? Class3 d ? ? ? ? ? ? Class5 e ? ? ? ? ? ? Class4 e ? ? ? ? ? ? Class2 So each entry in name can belong to more than one class. I want to represent the data as to see where overlaps occur that is which names are in the same Class Name and also which names are unique to a Class. I tough a Venn Diagram would work but this can only present numerical values for each Class, I would like each name to be presented by a dot or *. Any suggestions and how to would be appreciated. -- Regards/Groete/Mit freundlichen Gr??en/recuerdos/meilleures salutations/ distinti saluti/siong/du? y?/?????? Jurgens de Bruin ? ? ? ?[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Jim Holtman Data Munger Guru What is the problem that you are trying to solve?
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111010/bdbdf701/attachment.pl>
try this version:
x <- read.table(textConnection("Name Class
a Class1
a Class4
b Class2
b Class1
d Class3
d Class5
e Class4
e Class2"), header = TRUE)
closeAllConnections()
# add columns of numeric values of factors
x$name <- as.integer(x$Name)
x$class <- as.integer(x$Class)
# create plot area
plot(0
, type = 'n'
, xaxt = 'n'
, yaxt = 'n'
, xlab = ''
, ylab = ''
, xlim = c(0, max(x$class))
, ylim = c(0, max(x$name))
)
# now plot the rectangles
# rect(
# xleft = x$class - 1
# , ybottom = x$name - 1
# , xright = x$class
# , ytop = x$name
# , col = x$name
# )
# plot "*" instead
points(x$class - .5, x$name - .5, pch = "*", cex = 3)
# add the labels
axis(1
, at = seq(0.5, by = 1, length = length(levels(x$Class)))
, labels = levels(x$Class)
)
axis(2
, at = seq(0.5, by = 1, length = length(levels(x$Name)))
, labels = levels(x$Name)
)
On Mon, Oct 10, 2011 at 8:27 AM, Jurgens de Bruin <debruinjj at gmail.com> wrote:
Jim, This should work, would it be possible to plot * ?and not larg rec. On 10 October 2011 14:12, jim holtman <jholtman at gmail.com> wrote:
See if this gives you the presentation you want:
x <- read.table(textConnection("Name ? ?Class
a ? ? ? ? ? ? Class1
a ? ? ? ? ? ? Class4
b ? ? ? ? ? ? Class2
b ? ? ? ? ? ? Class1
d ? ? ? ? ? ? Class3
d ? ? ? ? ? ? Class5
e ? ? ? ? ? ? Class4
e ? ? ? ? ? ? Class2"), header = TRUE)
closeAllConnections()
# add columns of numeric values of factors
x$name <- as.integer(x$Name)
x$class <- as.integer(x$Class)
# create plot area
plot(0
? ?, type = 'n'
? ?, xaxt = 'n'
? ?, yaxt = 'n'
? ?, xlab = ''
? ?, ylab = ''
? ?, xlim = c(0, max(x$class))
? ?, ylim = c(0, max(x$name))
? ?)
# now plot the rectangles
rect(
? ? ?xleft = x$class - 1
? ?, ybottom = x$name - 1
? ?, xright = x$class
? ?, ytop = x$name
? ?, col = x$name
? ?)
# add the labels
axis(1
? ?, at = seq(0.5, by = 1, length = length(levels(x$Class)))
? ?, labels = levels(x$Class)
? ?)
axis(2
? ?, at = seq(0.5, by = 1, length = length(levels(x$Name)))
? ?, labels = levels(x$Name)
? ?)
On Mon, Oct 10, 2011 at 6:49 AM, Jurgens de Bruin <debruinjj at gmail.com>
wrote:
Hi, Please advice on what type of graph can be used to display the following data set. I have the following: Name ? ?Class a ? ? ? ? ? ? Class 1 a ? ? ? ? ? ? Class4 b ? ? ? ? ? ? Class2 b ? ? ? ? ? ? Class1 d ? ? ? ? ? ? Class3 d ? ? ? ? ? ? Class5 e ? ? ? ? ? ? Class4 e ? ? ? ? ? ? Class2 So each entry in name can belong to more than one class. I want to represent the data as to see where overlaps occur that is which names are in the same Class Name and also which names are unique to a Class. I tough a Venn Diagram would work but this can only present numerical values for each Class, I would like each name to be presented by a dot or *. Any suggestions and how to would be appreciated. -- Regards/Groete/Mit freundlichen Gr??en/recuerdos/meilleures salutations/ distinti saluti/siong/du? y?/?????? Jurgens de Bruin ? ? ? ?[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
-- Jim Holtman Data Munger Guru What is the problem that you are trying to solve?
-- Regards/Groete/Mit freundlichen Gr??en/recuerdos/meilleures salutations/ distinti saluti/siong/du? y?/?????? Jurgens de Bruin
Jim Holtman Data Munger Guru What is the problem that you are trying to solve?
On Mon, Oct 10, 2011 at 6:49 AM, Jurgens de Bruin <debruinjj at gmail.com> wrote:
Hi, Please advice on what type of graph can be used to display the following data set. I have the following: Name ? ?Class a ? ? ? ? ? ? Class 1 a ? ? ? ? ? ? Class4 b ? ? ? ? ? ? Class2 b ? ? ? ? ? ? Class1 d ? ? ? ? ? ? Class3 d ? ? ? ? ? ? Class5 e ? ? ? ? ? ? Class4 e ? ? ? ? ? ? Class2 So each entry in name can belong to more than one class. I want to represent the data as to see where overlaps occur that is which names are in the same Class Name and also which names are unique to a Class. I tough a Venn Diagram would work but this can only present numerical values for each Class, I would like each name to be presented by a dot or *.
Assuming DF is the indicated data.frame: library(gplots) with(DF, balloonplot(Name, Class, rep(1, nrow(DF)), label = FALSE))
Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111010/fbee8acc/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20111010/3a17df13/attachment.pl>
On Mon, Oct 10, 2011 at 8:49 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
On Mon, Oct 10, 2011 at 6:49 AM, Jurgens de Bruin <debruinjj at gmail.com> wrote:
Hi, Please advice on what type of graph can be used to display the following data set. I have the following: Name ? ?Class a ? ? ? ? ? ? Class 1 a ? ? ? ? ? ? Class4 b ? ? ? ? ? ? Class2 b ? ? ? ? ? ? Class1 d ? ? ? ? ? ? Class3 d ? ? ? ? ? ? Class5 e ? ? ? ? ? ? Class4 e ? ? ? ? ? ? Class2 So each entry in name can belong to more than one class. I want to represent the data as to see where overlaps occur that is which names are in the same Class Name and also which names are unique to a Class. I tough a Venn Diagram would work but this can only present numerical values for each Class, I would like each name to be presented by a dot or *.
Assuming DF is the indicated data.frame: library(gplots) with(DF, balloonplot(Name, Class, rep(1, nrow(DF)), label = FALSE))
Here is one additional idea:
xt <- xtabs(~ Class + Name, DF)
symnum(xt, cutpoints = 0:2/2, symbols = c(".", "+"))
Name Class a b d e Class1 + + . . Class2 . + . + Class3 . . + . Class4 + . . + Class5 . . + .
Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
On 10/10/2011 09:49 PM, Jurgens de Bruin wrote:
Hi, Please advice on what type of graph can be used to display the following data set. I have the following: Name Class a Class 1 a Class4 b Class2 b Class1 d Class3 d Class5 e Class4 e Class2 So each entry in name can belong to more than one class. I want to represent the data as to see where overlaps occur that is which names are in the same Class Name and also which names are unique to a Class. I tough a Venn Diagram would work but this can only present numerical values for each Class, I would like each name to be presented by a dot or *.
Hi Jurgens, Have a look at the intersectDiagram function in the plotrix package. This only plots the number of cases in each intersection, but it would be possible to plot dots or asterisks or even the lower case letters as long as there are not too many cases. Jim