[R] plot mixed variables
Sarah Goslee
sarah.goslee at gmail.com
Mon Dec 5 23:58:46 CET 2011
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 <jpntsang at yahoo.com> 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
More information about the R-help
mailing list