[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

ggplot(jet, aes(x = amtemp, y = thrust, colour = Classes)) +



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
tel. + 32 54/436 185
Thierry.Onkelinx at 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
~ 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" .
values which are between 100 - 90 to convert to character string
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),

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
color and the symbol of those 3 groups so they can be distinguished on
View this message in context:
Sent from the R help mailing list archive at Nabble.com.

R-help at r-project.org mailing list
PLEASE do read the posting guide
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