[R] Using color and plotting characters in a scatterplot matrix [Newbie Help]

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Wed Feb 4 10:40:16 CET 2009


First make a factor with the levels.

jet$Classes <- factor(ifelse(jet$amtemp < 90, "low", ifelse(jet$amtemp <
100, "medium", "high")))

Then make life easier and use ggplot

install.packages("ggplot2")
library("ggplot2")
ggplot(jet, aes(x = amtemp, y = thrust, colour = Classes)) +
geom_point()

HTH,

Thierry

------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens pfc_ivan
Verzonden: woensdag 4 februari 2009 8:59
Aan: r-help at r-project.org
Onderwerp: Re: [R] Using color and plotting characters in a scatterplot
matrix [Newbie Help]


I figured out how to do the rest, the only thing I need to do now is to
somehow change the numbers which are < 90 to a character string "low" .
The
values which are between 100 - 90 to convert to character string
"medium".
And the values larger than 100 to convert to character string "high".
Then I
would use this line. 

plot(thrust~amtemp, jet, col=as.numeric(jet$amtemp),
pch=as.numeric(jet$amtemp))

The thing is that I dont know how to convert those numerical values into
"low" "medium" and "high" 

Hmm, but then when I think about it better if its changed to the strings
above, it wont remember the exact numerical value. 

Basically what I want to do is make a scatterplot and then just change
the
color and the symbol of those 3 groups so they can be distinguished on
the
graph.
-- 
View this message in context:
http://www.nabble.com/Using-color-and-plotting-characters-in-a-scatterpl
ot-matrix--Newbie-Help--tp21824880p21825882.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at 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.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.




More information about the R-help mailing list