[R] Simple plot() question

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.ac.be
Tue Nov 16 16:00:48 CET 2004


try something like

plot(..., axes=FALSE)
axis(2); axis(1, labels=c("your labels"))

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "michael watson (IAH-C)" <michael.watson at bbsrc.ac.uk>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, November 16, 2004 3:45 PM
Subject: [R] Simple plot() question


> Hi
>
> First a simple question to do with plot().  How do I change the 
> x-axis
> labels on a plot?
>
> For example, I am plotting each row of a matrix, and I want each row 
> to
> be a line on my graph.  Simple really.  Eg:
>
> plot(sg[1,], type="l")
>
> When I do this, the x-axis is labelled 1:38, as I have 38 columns in 
> my
> matrix.  When I do:
>
> plot(sg[1,order(sg[1,])], type="l")
>
> Ideally I would like the x-axis labels to reflect the new order of 
> the
> columns, but they're still numbered 1:38... I've read the plot() 
> docs
> and the par() docs and can't figure it out - I know I'm missing
> something obvious, but what?
>
> Cheers
>
> Mick
>
> Michael Watson
> Head of Informatics
> Institute for Animal Health,
> Compton Laboratory,
> Compton,
> Newbury,
> Berkshire RG20 7NN
> UK
>
> Phone : +44 (0)1635 578411 ext. 2535
> Mobile: +44 (0)7990 827831
> E-mail: michael.watson at bbsrc.ac.uk
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list