Re: [R] Reversed but positive axis in trellis plots?

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Wed, 05 Mar 2008 17:16:41 +0000

On 3/5/08, Fredrik Karlsson <dargosch_at_gmail.com> wrote:
> Hi,
>
> In my discpipline, it is common to plot one acoustic property on a
> positive scale but from top to bottom on the ordinate and the same for
> another measurement on the abscissa.
> So, the origin of the plot is on the top right of the plot, with
> increasing values to the left /down. This is to highlight the
> correlation between the acoustic measurement and the position of the
> forming structure, for instance when teaching it to students.
>
> The grouping ability of the trellis plot is quite handy whan plotting
> many instances of the same thing, so I was wondering if it is possible
> to make a trellis xyplot behave this way?
> Converting all values to negative and changing labels to the negative
> of the negative seems one solution to the reverseness of the axes, but
> how do I change the position? Is it possible?

You can always specify explicit limits that are reversed, e.g., ylim=c(100, 0). If you want this as a general behaviour but don't know your data's range beforehand, one option might have been

    prepanel = function(x, y, ...) {

        list(ylim = rev(range(y)))
    }

Unfortunately, this doesn't work when relation="same", as the step of combining the per-panel limits to obtain a common range disregards the order.

-Deepayan



R-help_at_r-project.org 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 05 Mar 2008 - 17:20:43 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 05 Mar 2008 - 17:30:18 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.

list of date sections of archive