[R] Plotting a x axis from a vector with rownames

Christophe Declercq cdeclercq at nordnet.fr
Mon Mar 4 15:07:39 CET 2002


> De : owner-r-help at stat.math.ethz.ch
> [mailto:owner-r-help at stat.math.ethz.ch]De la part de Sven Garbade
> Envoyé : lundi 4 mars 2002 15:32
> À : R-Help
> Objet : [R] Plotting a x axis from a vector with rownames
>
>
> Hi all,
>
> suppose there is a vector y with rownames:
>
> > y
>  cond1  cond2  cond3  cond4
> 78.952 87.308 86.490 74.040
>
> how can I easily plot this vector using the rownames? plot(y)
> gives me a
> plot with a x-axis from 1 to 4 in 0.5 steps, also plot(rownames(y), y)
> and plot(y ~ rownames(y) don't work. I know I can build a x-axis with
> axis(1, ...), but in this case I need a character string like
> c("cond1,
> "", "cond2", "", ...), because the x-axis has 7 tick marks. I'm
> wondering about an easier way (like barplot does).

Is that what you want?

> y<-c(78.952, 87.308, 86.490, 74.040)
> names(y)<-c("cond1",  "cond2",  "cond3",  "cond4")
> stripchart(y~names(y), vertical=TRUE)

Hope it helps.

Christophe
--
Christophe DECLERCQ, MD
Observatoire Régional de la Santé Nord-Pas-de-Calais
13, rue Faidherbe 59046 LILLE Cedex FRANCE
Phone +33 3 20 15 49 24
Fax   +33 3 20 55 92 30
E-mail c.declercq at orsnpdc.org


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list