Em 18-07-2014 08:07, Stefano Sofia escreveu:
Dear R list users,
I have a data frame called catchment like
"year" "season" "rainfall" "colour"
1953 1 409.5 "black"
1953 2 145.3 "black"
1953 3 285.6 "red"
1953 4 275.0 "black"
1954 1 273.8 "black"
1954 2 342.8 "blue"
1954 3 167.6 "black"
1954 4 341.1 "black"
1955 1 182.3 "blue"
1955 2 211.8 "black"
1955 3 222.6 "black"
1955 4 522.1 "black"
1956 1 248.7 "red"
1956 2 244.9 "black"
...
and I would like to plot it with the colours specified in the column colour (at
the moment the colours are three: black, red and blue. I would like to have the
possibility to add oher colours to this list).
With
plot(catchment$year, catchment$rainfall, main="River Aso", xlab="years", ylab="mm",
type="p", col=catchment$colour)
the colours displayed in the graph are not the ones I have chosen.
I looked for the answer, which probably involves a transformation to factor,
but I am not able to understand well the solution.
Could somebody help me?
Thank you
Stefano Sofia
________________________________
AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere
informazioni confidenziali, pertanto è destinato solo a persone autorizzate
alla ricezione. I messaggi di posta elettronica per i client di Regione Marche
possono contenere informazioni confidenziali e con privilegi legali. Se non si
è il destinatario specificato, non leggere, copiare, inoltrare o archiviare
questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al
mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi
dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed
urgenza, la risposta al presente messaggio di posta elettronica può essere
visionata da persone estranee al destinatario.
IMPORTANT NOTICE: This e-mail message is intended to be received only by
persons entitled to receive the confidential information it may contain. E-mail
messages to clients of Regione Marche may contain information that is
confidential and legally privileged. Please do not read, copy, forward, or
store this message unless you are an intended recipient of it. If you have
received this message in error, please forward it to the sender and delete it
completely from your computer system.
[[alternative HTML version deleted]]
______________________________________________
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.
did you try the palette() function?
you can define a new like:
> palette(c("black","red","blue"))
then you can call the colors by numbers (1,2,3)
replace the color name in the column by the respective 1,2,3 numbers ant
give a try.
I haven't try it, but it's the "natural" way I can think of.
|
|
--
João Azevedo Patrício
Tel.: +31 91 400 53 63
Portugal
@ http://tripaforra.bl.ee
"Take 2 seconds to think before you act"
______________________________________________
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.