plot(xx1, yy, ylim = c(-13.5, 4), col="blue", xaxt="n")
axis(1, at=c(1, 2), labels=c("C", "D"))
Defining your own axes with axis() offers a great deal of flexibility.
And thank you for providing a small reproducible example.
Sarah
On Mon, Dec 5, 2011 at 5:43 PM, Juliet Ndukum wrote:
>
>
>
> My data consists of a numeric (yy)
> variable and a categorical (xx) variable, as shown below.
>
>
>
>
> xx =
> c(rep("C", 5), rep("D",5))
>
> yy = rnorm(10, 0, 4)
>
> xx1 =
> as.integer(as.factor(xx))
>
>
>
> plot(xx1, yy, ylim =
> c(-13.5, 4), col="blue")
>
>
>
> I
> wish to generate a scatter plot of the data such that instead of 1 it prints
> C,
> and instead of 2, it prints D on the x- axis.
>
>
>
> Could
> someone help me with an R code on how to go about this. Thank you in advance
> for your help,
>
> JN
> [[alternative HTML version deleted]]
>
>
--
Sarah Goslee
http://www.functionaldiversity.org
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.