[R] [FORGED] How to remove the grid around the plot(ca(...)) function?

Paul Murrell paul at stat.auckland.ac.nz
Fri Oct 9 00:11:35 CEST 2015


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/



More information about the R-help mailing list