<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Scatterplot of two sets of coordinates and a partionning into...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="https://rpkg.net/assets/examples.css" />
</head><body>

<table width="100%" summary="page for s.match.class"><tr><td>s.match.class</td><td style="text-align: right;">R Documentation</td></tr></table>

<h2>Scatterplot of two sets of coordinates and a partionning into classes</h2>

<h3>Description</h3>

<p>Performs a graphical representation of two sets of coordinates
(different colors and symbols) and a partitionning  into classes
</p>


<h3>Usage</h3>

<pre>
s.match.class(df1xy, df2xy, fac, wt = rep(1/nrow(df1xy), nrow(df1xy)),
xax = 1, yax = 2, pch1 = 16, pch2 = 15, col1 = rep("lightgrey",
nlevels(fac)), col2 = rep("darkgrey", nlevels(fac)), cpoint = 1, label =
levels(fac), clabel = 1, cstar = 1, cellipse = 0, axesell = TRUE, xlim =
NULL, ylim = NULL, grid = TRUE, addaxes = TRUE, cgrid = 1,
include.origin = TRUE, origin = c(0, 0), sub = "", csub = 1.25, possub =
"bottomleft", pixmap = NULL, contour = NULL, area = NULL, add.plot = FALSE)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>df1xy</code></td>
<td>
<p>a dataframe with the first system of coordinates</p>
</td></tr>
<tr valign="top"><td><code>df2xy</code></td>
<td>
<p>a dataframe with the secocnd system of coordinates</p>
</td></tr>
<tr valign="top"><td><code>fac</code></td>
<td>
<p>a factor partitioning the rows of the data frame in classes</p>
</td></tr>
<tr valign="top"><td><code>wt</code></td>
<td>
<p>a vector of weights</p>
</td></tr>
<tr valign="top"><td><code>xax</code></td>
<td>
<p>a number indicating which column should be plotted on the x-axis</p>
</td></tr>
<tr valign="top"><td><code>yax</code></td>
<td>
<p>a number indicating which column should be plotted on the x-axis</p>
</td></tr>
<tr valign="top"><td><code>pch1</code></td>
<td>
<p>if <code>cpoint</code> &gt; 0, an integer specifying the symbol or the single character to be used for plotting points</p>
</td></tr>
<tr valign="top"><td><code>pch2</code></td>
<td>
<p>if <code>cpoint</code> &gt; 0, an integer specifying the symbol or the single character to be used for plotting points</p>
</td></tr>
<tr valign="top"><td><code>col1</code></td>
<td>
<p>a color for symbols</p>
</td></tr>
<tr valign="top"><td><code>col2</code></td>
<td>
<p>a color for symbols</p>
</td></tr>
<tr valign="top"><td><code>cpoint</code></td>
<td>
<p>a character size for plotting the points, used with <code>par("cex")*cpoint</code>. If zero, no points are drawn</p>
</td></tr>
<tr valign="top"><td><code>label</code></td>
<td>
<p>a vector of strings of characters for the couple labels</p>
</td></tr>
<tr valign="top"><td><code>clabel</code></td>
<td>
<p>if not NULL, a character size for the labels, used with <code>par("cex")*clabel</code></p>
</td></tr>
<tr valign="top"><td><code>cstar</code></td>
<td>
<p>a number between 0 and 1 which defines the length of the star size</p>
</td></tr>
<tr valign="top"><td><code>cellipse</code></td>
<td>
<p>a positive coefficient for the inertia ellipse size</p>
</td></tr>
<tr valign="top"><td><code>axesell</code></td>
<td>
<p>a logical value indicating whether the ellipse axes should be drawn</p>
</td></tr>
<tr valign="top"><td><code>xlim</code></td>
<td>
<p>the ranges to be encompassed by the x axis, if NULL they are computed</p>
</td></tr>
<tr valign="top"><td><code>ylim</code></td>
<td>
<p>the ranges to be encompassed by the y axis, if NULL they are computed</p>
</td></tr>
<tr valign="top"><td><code>grid</code></td>
<td>
<p>a logical value indicating whether a grid in the background of the plot should be drawn</p>
</td></tr>
<tr valign="top"><td><code>addaxes</code></td>
<td>
<p>a logical value indicating whether the axes should be plotted</p>
</td></tr>
<tr valign="top"><td><code>cgrid</code></td>
<td>
<p>a character size, parameter used with par(&quot;cex&quot;)* <code>cgrid</code> to indicate the mesh of the grid</p>
</td></tr>
<tr valign="top"><td><code>include.origin</code></td>
<td>
<p>a logical value indicating whether the point &quot;origin&quot; should belong to the graph space</p>
</td></tr>
<tr valign="top"><td><code>origin</code></td>
<td>
<p>a fixed point in the graph space, for example c(0,0) for
the origin of axes</p>
</td></tr>
<tr valign="top"><td><code>sub</code></td>
<td>
<p>a string of characters to be inserted as legend</p>
</td></tr>
<tr valign="top"><td><code>csub</code></td>
<td>
<p>a character size for the legend, used with <code>par("cex")*csub</code></p>
</td></tr>
<tr valign="top"><td><code>possub</code></td>
<td>
<p>a string of characters indicating the sub-title position (&quot;topleft&quot;, &quot;topright&quot;, &quot;bottomleft&quot;, &quot;bottomright&quot;)</p>
</td></tr>
<tr valign="top"><td><code>pixmap</code></td>
<td>
<p>a <code>pixmap</code> object</p>
</td></tr>
<tr valign="top"><td><code>contour</code></td>
<td>
<p>a dataframe with 4 columns to plot the contour of the map : each row gives a segment (x1,y1,x2,y2)</p>
</td></tr>
<tr valign="top"><td><code>area</code></td>
<td>
<p>a dataframe of class 'area' to plot an areal map</p>
</td></tr>
<tr valign="top"><td><code>add.plot</code></td>
<td>
<p>if TRUE, add the plot to the current graphic device</p>
</td></tr>
</table>


<h3>Value</h3>

<p>The matched call.
</p>


<h3>Author(s)</h3>

<p>StÃ©phane Dray <a href="mailto:stephane.dray@univ-lyon1.fr">stephane.dray@univ-lyon1.fr</a>
</p>


<h3>See Also</h3>

<p><code>s.class</code>, <code>s.match</code>
</p>


<h3>Examples</h3>

<pre>
xy &lt;- data.frame(matrix(rnorm(100), 50, 2))
xy[, 1] &lt;- xy[, 1] + rep(seq(0, 12, by = 3), rep(10, 5))
xy[, 2] &lt;- xy[, 2] + rep(seq(0, 12, by = 3), rep(10, 5))
fac &lt;- gl(5, 10)
xy2 &lt;- xy + matrix(rnorm(100), 50, 2) + 1

if(adegraphicsLoaded()) {
  mat &lt;- rbind(xy, xy2)
  minmat &lt;- apply(mat, 2, min)
  maxmat &lt;- apply(mat, 2, max)
  lag &lt;- 0.1 * abs(minmat - maxmat)
  xli &lt;- c(minmat[1] - lag[1], maxmat[1] + lag[1])
  yli &lt;- c(minmat[2] - lag[2], maxmat[2] + lag[2])
  
  g1 &lt;- s.class(xy, fac, ellipseSize = 0, col = rep("grey45", nlevels(fac)), xlim = xli, 
    ylim = yli, plabels.cex = 0, plot = FALSE)
  g2 &lt;- s.class(xy2, fac, ellipseSize = 0, col = rep("grey75", nlevels(fac)), xlim = xli, 
    ylim = yli, plabels.cex = 0, plot = FALSE)
  g3 &lt;- s.match(g1@stats$means, g2@stats$means, xlim = xli, ylim = yli, plines.lwd = 2, 
    psub.text = "xy -&gt; xy2", plot = FALSE)
  
  g4 &lt;- do.call("superpose", list(g1, g2))
  g4@Call &lt;- call("superpose", g1@Call, g2@Call)
  g4 &lt;- do.call("superpose", list(g4, g3))
  g4@Call &lt;- call("superpose", g4@Call, g3@Call)
  g4
  
} else {
  s.match.class(xy, xy2, fac)
}
</pre>


</body></html>
