# Superpose two graphics

### Description

This function superposes two graphics and extends the graphical constraints of a first graphic to a second one.

### Usage

1 2 3 |

### Arguments

`g1` |
an object of class |

`g2` |
an object of class |

`e1` |
an object of class |

`e2` |
an object of class |

`which` |
if |

`plot` |
a logical indicating if the graphics is displayed |

### Details

The created `ADEgS`

object is a layout of two graphical objects.
Each of the two objects superposed still have its graphical parameters in the created layout.
However, the `ADEgS`

displayed favour the graphical parameters of the object below :
displayed limits, grid, legend and axes are those of `g1`

(respectively `e1`

) and `g2`

(respectively `e2`

) has transparent background and labels' boxes.

The `superpose`

method is defined for:

`signature(g1 = "ADEgS", g2 = "ADEg", which = "numeric", plot = "logical")`

`signature(g1 = "ADEgS", g2 = "ADEg", which = "numeric", plot = "ANY")`

`signature(g1 = "ADEgS", g2 = "ADEg", which = "missing", plot = "ANY")`

: If`which`

is`missing`

, the last`ADEg`

of`g1@ADEglist`

is used as the base of superposition. In that case,`which = length(g1)`

`signature(g1 = "ADEgORtrellis", g2 = "ADEgORtrellis", which = "ANY", plot = "ANY")`

: If`g1`

is an`ADEg`

object, no`which`

is needed.`signature(g1 = "ADEgS", g2 = "ADEgS", which = "missing", plot = "ANY")`

The `+`

method is defined for:

`signature(e1 = "ADEg", e2 = "ADEg")`

: superpose e2 on e1`signature(e1 = "ADEg", e2 = "ADEgS")`

: superpose e2 to e1`signature(e1 = "ADEgS", e2 = "ADEg")`

: calls the`+`

method with signature`(e1 = "ADEg", e2 = "ADEgS")`

.

### Value

An object of class `"ADEgS"`

.

### Author(s)

Alice Julien-Laferriere, Aurelie Siberchicot aurelie.siberchicot@univ-lyon1.fr and Stephane Dray

### See Also

`add.ADEg`

`ADEgS`

`ADEg`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
cha <- LETTERS[1:20]
xy <- cbind.data.frame(runif(length(cha)), runif(length(cha)))
g1 <- s.label(xy, labels = cha, ppoints.alpha = 0, pbackground.col = "grey85")
g2 <- s.label(xy, labels = cha, plabels.cex = 0, paxes.draw = TRUE, ppoints.pch = 4,
ppoints.col = "red")
g3 <- superpose(g1, g2, plot = TRUE)
g4 <- superpose(g2, g1, plot = TRUE)
data(jv73, package = "ade4")
pca1 <- ade4::dudi.pca(jv73$morpho, scannf = FALSE)
g5 <- s.label(pca1$li, plabels.optim = TRUE)
g6 <- s.class(pca1$li, jv73$fac.riv, starSize = 0, ellipseSize = 0, chullSize = 1,
ppolygons.alpha = 0.4, col = rainbow(12), ppoints.cex = 0)
g5 + g6
## Not run: g7 <- s.label(pca1$li, plabels.optim = TRUE, facets = jv73$fac.riv, plot = FALSE)
g8 <- s.class(pca1$li, jv73$fac.riv, facets = jv73$fac.riv, starSize = 0, chullSize = 1,
ellipseSize = 0, ppolygons.alpha = 0.4, col = rainbow(12), ppoints.cex = 0, plot = FALSE)
g9 <- superpose(g7, g8, plot = TRUE)
## End(Not run)
``` |