[Rd] areaplot

From: Arni Magnusson <arnima_at_hafro.is>
Date: Mon, 14 Jun 2010 21:50:11 +0000 (UTC)


I would like to propose adding a new plot function to the 'graphics' package. The new function is called areaplot() and I have implemented it as a generic function that supports a variety of data classes.

An area plot consists of a simple line, like plot(x, y, type="l"), except the area between 0 and the line is a filled polygon. Areas can be stacked on top of each other, like barplot(matrix(3:1)), and the data can be plotted as proportions, so stacked areas equal 1.

Area plots are commonly found in the scientific literature. Currently, drawing an area plot in R using polygon() is a hassle at best, and drawing a stacked area plot can be a major task for beginning users.

If you source the attached areaplot.R file, and read the help page and examples, you will see that I made an effort to implement the following features:

On a technical note, I included the support for different data classes inside areaplot.default(), instead of implementing separate areaplot.foo() functions. It would be trivial to do move the if-clauses to separate functions, but I wasn't sure if that would improve the code or not, since the necessary data manipulations are minimal. It was only areaplot.formula that should obviously be a separate function.

Comparable functions are found in some user packages, highlighting the general need of an area plot function, but the existing functions do not follow the R plotting standards, nor do they support such a variety of data classes, or provide stacked and proportional area plots.

I'm looking forward to your feedback,

Arni



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Mon 14 Jun 2010 - 21:54:39 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 Tue 15 Jun 2010 - 12:01:09 GMT.

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

list of date sections of archive