Skip to content
Prev 131065 / 398506 Next

plotting step functions in plot vs. xyplot

On 12/2/07, Dylan Beaudette <dylan.beaudette at gmail.com> wrote:
Yes (though not through any fault of your own). Unile plot(), type='s'
in panel.xyplot() sorts the values before doing the steps. This
difference was not intentional (originally), but it's been around long
enough that I decided to make it a "feature" (i.e., document it) when
I discovered it.

You can still get what you want by sorting on the y-axis, and you can
do that by adding 'horizontal = TRUE'. The more general fix that I had
planned was to have panel.points() etc work as plot, so that you could
do

xyplot(..., type = "s", panel = panel.points)

It turns out that I haven't implemented that yet, but it should be in
the next update (but you need at least R 2.5.0 to use it).

-Deepayan