# [R] Symbols for male/female

Ben Bolker ben at zoo.ufl.edu
Thu Oct 31 15:47:16 CET 2002

  If you're using LaTeX anyway, one possibility is to use the psfrag
package to post-process the postscript ...

testmf.R
----------------
x <- runif(10)
y <- runif(10)
mf <- sample(0:1,10,TRUE)
postscript("testmf.eps",width=4,height=4,
horizontal = FALSE, onefile = FALSE, paper = "special")
plot(x,y,type="n")
text(x,y,ifelse(mf==0,"m","f"))
dev.off()

testmf.tex
-----------------
\documentclass{article}
\usepackage{graphicx}
\usepackage{psfrag}
\usepackage{wasysym}

\psfrag{m}{\mars}
\psfrag{f}{\venus}

\begin{document}
\includegraphics{testmf}
\end{document}

On 31 Oct 2002, Lorenz Gygax wrote:

>
> Dear all,
>
> I would like to use the biological symbols for male and female as plotting
> symbols in a scatterplot (ideally filled and non-filled). R does not seem
> to have these symbols using pch= in plot() nor are they implemented via
> expression() or at least I did not find them. I found that the symbols are
> e.g. available in the wasysym and the marvosym package in LaTeX.
>
> I have coded two very rough functions that are able to approximate those
> symbols, but not surprisingly, they are not very efficient regarding the
> file size they produce (I have included the code for the female symbol at
> the end of the mail).
>
> Is there a more or less straightforward way to implement these symbols so
> that they can be accessed either by pch= or expression()? Can you give me
>
> Thanks and regards, Lorenz
>

--
318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._