[R] Plot colour according to column

Jim Lemon jim at bitwrit.com.au
Wed Feb 9 08:50:52 CET 2011


On 02/09/2011 06:49 PM, Jim Lemon wrote:
> On 02/08/2011 09:14 PM, anoopmj wrote:
>>
>> Hi,
>>
>> I am trying to plot several columns in different graphs in columns and
>> rows.
>> The first column of my data file is the time, and the third is the
>> 'elevation angle' with 19 different numbers. I would like to plot the
>> rest
>> of the columns with the x axis as time and the individual angles in
>> different colours.
>>
> Hi anoopmj,
> I'm not sure that I understand what you want to do, but perhaps this
> will help:
>
> HCHO$time<-strptime(HCHO$V1,format="%H:%M:%S")

Oops, forgot these lines:

library(plotrix)
HCHO$colors<-color.scale(HCHO$V3,c(1,0),c(0,1),c(1,0))

> plot(HCHO$time,HCHO$V4,type="h",col=HCHO$colors)
> HCHO<-read.table("qdoas.qdo",sep="\t")
>
> Jim



More information about the R-help mailing list