Thank you every body for your suggestion. It does help.
On Fri, Apr 6, 2012 at 2:37 AM, windmagics_lsl wrote:
> I think there may 3 legends should be added in your plot
> the argument col, pch and pt.cex should be in the same length with legend,
> but the objects col, pch
> and cex you defined
I think there may 3 legends should be added in your plot
the argument col, pch and pt.cex should be in the same length with legend,
but the objects col, pch
and cex you defined former have 16*3 length. I guess the follow codes may
work
col <- rep(c("blue", "red", "darkgreen"), c(16, 16, 16))
##
Thanks,
anyway, using build-in R features is preferable for colours
with(data, plot(axis1, axis2, col= c("red", "blue",
"green")[as.numeric(data$Region)]))
legend("topright", legend=levels(data$Region), fill= c("red", "blue",
"green"))
although sometimes can be preferable to get advantage of
He provided data, yet in an inconvenient way at the bottom of his post.
Kumar, please use dput() to provide data to the list, because its much
easier to import:
dput(data)## name data is made up by me
structure(list(Region = structure(c(2L, 2L, 2L, 2L, 2L, 3L, 3L,
3L, 3L, 3L, 1L, 1L, 1L, 1L,
Hi
>
> I have a bivariate plot of axis2 against axis1 (data below). I would
like
> to use different size, type and color for points in the plot for the
point
> coming from different region. For some reasons, I cannot get it done.
Below
> is my code.
>
> col <- rep(c("blue", "red", "darkgreen"
5 matches
Mail list logo