Luca Meyer
2015-Oct-08 18:06 UTC
[R] How to remove the grid around the plot(ca(...)) function?
Hello R-experts, Could anyone suggest how I can remove the grid coming out of the plot(ca(...)) function? For instance I have: library(ca) v1 <- c(10,15,20,15,25) v2 <- c(23,4,7,12,2) v3 <- c(10,70,2,3,7) d1 <- data.frame(v1,v2,v3) rownames(d1) <- c("B1","B2","B3","B4","B5") plot(ca(d1), mass = c(TRUE,FALSE), xlab="", ylab="") As you can I could remove the X and Y axis label, but basically I am looking for a chart containing only the data points - with relative inertia represented by their size - and labels with no extra lines or number, any clue on how I can do that? Thank you, Luca [[alternative HTML version deleted]]
David L Carlson
2015-Oct-08 21:52 UTC
[R] How to remove the grid around the plot(ca(...)) function?
You will have to construct it yourself using plot(), points(), and text():> d1.ca <- ca(d1) > d1.plt <- plot(d1.ca)d1.ca$rowmass will contain the row masses and d1.ca$colmass the column masses d1.ca$rownames and d1.ca$colnames, the names d1.plt$rows has the row coordinates and d1.plt$cols, the column coordinates. ------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Luca Meyer Sent: Thursday, October 8, 2015 1:07 PM To: r-help Subject: [R] How to remove the grid around the plot(ca(...)) function? Hello R-experts, Could anyone suggest how I can remove the grid coming out of the plot(ca(...)) function? For instance I have: library(ca) v1 <- c(10,15,20,15,25) v2 <- c(23,4,7,12,2) v3 <- c(10,70,2,3,7) d1 <- data.frame(v1,v2,v3) rownames(d1) <- c("B1","B2","B3","B4","B5") plot(ca(d1), mass = c(TRUE,FALSE), xlab="", ylab="") As you can I could remove the X and Y axis label, but basically I am looking for a chart containing only the data points - with relative inertia represented by their size - and labels with no extra lines or number, any clue on how I can do that? Thank you, Luca [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Paul Murrell
2015-Oct-08 22:11 UTC
[R] [FORGED] How to remove the grid around the plot(ca(...)) function?
Hi The plot.ca() function contains explicit calls to axis(), box(), and abline(), so, for example, ... plot(ca(d1), mass = c(TRUE,FALSE), xlab="", ylab="", axes=FALSE) ... does not work. One option is draw-it-yourself (as suggested by David Carlson), another option is to copy the function source and write your own version that has those axis(), box(), and abline() calls removed (not recommended for a number of reasons), and another option is like this ... # Draw original plot plot(ca(d1), mass = c(TRUE,FALSE), xlab="", ylab="") # Generate 'grid' version of the plot library(gridGraphics) grid.echo() # What has been drawn? grid.ls() # Remove whichever bits you want grid.remove("axis", grep=TRUE, global=TRUE) grid.remove("box", grep=TRUE) grid.remove("abline", grep=TRUE, global=TRUE) Paul On 09/10/15 07:06, Luca Meyer wrote:> Hello R-experts, > > Could anyone suggest how I can remove the grid coming out of the > plot(ca(...)) function? > > For instance I have: > > library(ca) > v1 <- c(10,15,20,15,25) > v2 <- c(23,4,7,12,2) > v3 <- c(10,70,2,3,7) > d1 <- data.frame(v1,v2,v3) > rownames(d1) <- c("B1","B2","B3","B4","B5") > plot(ca(d1), mass = c(TRUE,FALSE), xlab="", ylab="") > > As you can I could remove the X and Y axis label, but basically I am > looking for a chart containing only the data points - with relative inertia > represented by their size - and labels with no extra lines or number, any > clue on how I can do that? > > Thank you, > > Luca > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >-- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 paul at stat.auckland.ac.nz http://www.stat.auckland.ac.nz/~paul/
Luca Meyer
2015-Oct-09 11:17 UTC
[R] [FORGED] How to remove the grid around the plot(ca(...)) function?
That worked just fine. Thanks Paul! Luca 2015-10-09 0:11 GMT+02:00 Paul Murrell <paul at stat.auckland.ac.nz>:> Hi > > The plot.ca() function contains explicit calls to axis(), box(), and > abline(), so, for example, ... > > plot(ca(d1), mass = c(TRUE,FALSE), xlab="", ylab="", axes=FALSE) > > ... does not work. > > One option is draw-it-yourself (as suggested by David Carlson), another > option is to copy the function source and write your own version that has > those axis(), box(), and abline() calls removed (not recommended for a > number of reasons), and another option is like this ... > > # Draw original plot > plot(ca(d1), mass = c(TRUE,FALSE), xlab="", ylab="") > # Generate 'grid' version of the plot > library(gridGraphics) > grid.echo() > # What has been drawn? > grid.ls() > # Remove whichever bits you want > grid.remove("axis", grep=TRUE, global=TRUE) > grid.remove("box", grep=TRUE) > grid.remove("abline", grep=TRUE, global=TRUE) > > Paul > > On 09/10/15 07:06, Luca Meyer wrote: > >> Hello R-experts, >> >> Could anyone suggest how I can remove the grid coming out of the >> plot(ca(...)) function? >> >> For instance I have: >> >> library(ca) >> v1 <- c(10,15,20,15,25) >> v2 <- c(23,4,7,12,2) >> v3 <- c(10,70,2,3,7) >> d1 <- data.frame(v1,v2,v3) >> rownames(d1) <- c("B1","B2","B3","B4","B5") >> plot(ca(d1), mass = c(TRUE,FALSE), xlab="", ylab="") >> >> As you can I could remove the X and Y axis label, but basically I am >> looking for a chart containing only the data points - with relative >> inertia >> represented by their size - and labels with no extra lines or number, any >> clue on how I can do that? >> >> Thank you, >> >> Luca >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. >> >> > -- > Dr Paul Murrell > Department of Statistics > The University of Auckland > Private Bag 92019 > Auckland > New Zealand > 64 9 3737599 x85392 > paul at stat.auckland.ac.nz > http://www.stat.auckland.ac.nz/~paul/ >[[alternative HTML version deleted]]