# Draw Symbols (User Defined) on a Lattice Plot

### Description

This function draws symbols on a lattice plot. It is similar to
the builtin `symbols`

function with the difference that it plots
symbols defined by the user rather than a prespecified set of
symbols.

### Usage

1 2 | ```
panel.my.symbols(x, y, symb, inches=1, polygon=FALSE,
..., symb.plots=FALSE, subscripts, MoreArgs)
``` |

### Arguments

`x, y` |
The |

`symb` |
Either a matrix, list, or function defining the symbol to
be plotted. If it is a matrix or list it needs to be formatted that
it can be passed directly to the |

`inches` |
The size of the square containing the symbol in inches
(note: unlike |

`polygon` |
If TRUE, use |

`symb.plots` |
Currently not implemented. |

`...` |
Additional arguments will be replicated to the same length
as |

`subscripts` |
subscripts for the current panel |

`MoreArgs` |
A list with any additional arguments to be passed to
the |

### Details

The `symb`

argument can be a 2 column matrix or a list with
components 'x' and 'y' that defines points on the interval [-1,1] that
will be connected with lines to draw the symbol. If you want a closed
polygon then be sure to replicate the 1st point as the last point or
use the `polygon`

option.

If any point contains an NA then the line will not be drawn to or from that point. This can be used to create a symbol with disjoint parts that should not be connected.

If `symb`

is a function then any unmatched
arguments that end up in the '...' argument will be replicated to the
same length as 'x' (using the `rep`

function) then the values
will be passed one at a time to the `symb`

function. If
`MoreArgs`

is specified, the elements of it will also be passed
to `symb`

without modification. The `symb`

function can
either return a matrix or list with the points that will then be
passed to the `llines`

function (see above).

### Value

This function is run for its side effect of plotting, it returns an invisible NULL.

### Note

Plotting coordinates and sizes are based on the size of the device at the time the function is called. If you resize the device after plotting, all bets are off.

### Author(s)

Greg Snow 538280@gmail.com

### See Also

`symbols`

, `my.symbols`

, `subplot`

,
`mapply`

, `ms.polygram`

, `lines`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ```
if(require(lattice)) {
tmpdf <- data.frame( x=1:10, y=1:10, g=rep( c("A","B"), each=5 ),
z=c(1:5,5:1) )
xyplot( y ~ x, tmpdf, panel=panel.my.symbols, symb=ms.female, inches=0.3 )
xyplot( y ~ x | g, tmpdf, panel=panel.my.symbols, symb=ms.male, inches=0.3)
xyplot( y ~ x, tmpdf, panel=panel.superpose, groups=g,
panel.groups= function(group.number, ...) {
if(group.number==1) {
panel.my.symbols(..., symb=ms.male)
} else {
panel.my.symbols(..., symb=ms.female)
} },
inches=0.3
)
xyplot( y ~ x, tmpdf, panel=panel.my.symbols, symb=ms.polygram, n=tmpdf$z,
inches=0.3)
xyplot( y ~ x | g, tmpdf, panel=panel.my.symbols, symb=ms.polygram,
n=tmpdf$z, inches=0.3)
xyplot( y ~ x, tmpdf, panel=panel.superpose, groups=g,
panel.groups = panel.my.symbols,
inches=0.3, symb=ms.polygon, n=tmpdf$z, polygon=TRUE,
adj=rep(c(0,pi/4),5)
)
}
``` |