Re: [R] Filled step-function?

From: Beate Kowalczyk <beate.kowalczyk_at_googlemail.com>
Date: Wed, 16 May 2007 13:46:25 +0200

Hi Petr,

polygon doesn't work very well, because I need a graphical display for the laboratory results of my institute. So I have a lot of data in .csv-format, and I don't really want to define a new polygon for each dataset, because then I have to do a lot of extra-work. I need a solution that works like the following, but with coloring the area under the function (like the image in my first posting):

labdata <- read.csv("labdata.csv", header=TRUE) attach(labdata) #for using column-names as variables plot(variable1,variable2,type="s",main="Title",ylim=c(120,0),xlim=c(0,10))

For each .csv-dataset I want to use this code with only slight adjustments...

Tanks again, Beate

Petr Klasterecky schrieb:
> Hi,
>
> I am not sure what exactly you would like to fill up and how, but take a
> look at
> ?polygon
> and the examples given there.
>
> hth
> Petr
>
>
> Beate Kowalczyk napsal(a):
>
>> Hello,
>>
>> I'd like to generate a filled step-function in R as you can see in the
>> attachement (image is generated by grapher, but I need a freely
>> available alternative). The problem is, that I don't know, how to fill
>> it up. My code right now looks like this:
>>
>> pH <- c(0,6.1,6.1,6.3,6.6,7.3,0)
>> Tiefe <- c(0,0,10,40,80,120,10)
>> plot(pH,Tiefe,type="s",main="Tiefenfunktion pH",ylim=c(120,0),xlim=c(0,23))
>>
>> Can someone give me an hint how to work on this?
>>
>> Thanks, Beate
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> ------------------------------------------------------------------------
>>
>> ______________________________________________
>> R-help_at_stat.math.ethz.ch 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.
>>
>
>



R-help_at_stat.math.ethz.ch 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. Received on Wed 16 May 2007 - 11:50:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 May 2007 - 12:31:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.