[R] stepfuns: R^2 -> R

Duncan Murdoch dmurdoch at pair.com
Fri May 2 14:09:00 CEST 2003

On Fri, 2 May 2003 05:49:30 -0500 (CDT), you wrote:

>Does anyone have any suggestions on perspective plotting of piecewise constant functions?
>Ideally, I would like something like plot.stepfun for functions that are piecewise
>constant on polygons.   Even pointers to non-R strategies would be welcome at this stage.

You could use one of the 3D packages.  Daniel Adler and I have agreed
to merge our efforts, but you can get either one now.  Mine is
available from <http://www.stats.uwo.ca/faculty/murdoch/software> as
djmrgl.zip, his is available at
<http://wsopuppenkiste.wiso.uni-goettingen.de/~dadler/rgl>.  With
mine, you could use a function like persp() after evaluating the
function on a grid.  You could get a somewhat better looking result by
drawing the surface explicitly as triangles or quadrilaterals; that's
why my hist3d function does.

One disadvantage to both of these packages is that they only produce
bitmapped graphics, so the results don't look sharp if printed.  The
solution is to produce really big bitmaps.

Duncan Murdoch

More information about the R-help mailing list