[R] Changing axis origin for plot
Jim Lemon
jim at bitwrit.com.au
Wed Mar 24 10:17:21 CET 2010
On 03/24/2010 11:08 AM, Ralf B wrote:
> Hi all,
>
> I am plotting data using the simple plot function:
>
> plot(data$x, data$y)
>
> which results in a standard plot with the axis origin in the lower left corner.
>
> ^
> |
> |
> |
> |
> | O O
> | O O
> ---------------------------------->
>
> Since my data are screen coordinates I need mirrored axis so that the
> origin for both axis is in the upper left corner; like this:
>
> |-------------------------------->
> | O O
> | O O
> |
> |
> |
> |
> |
> v
>
> Anybody know how? I did not find any parameter when consulting the
> help file. I assume its a more general parameter but where is that
> documented?
Hi Ralf,
I don't know of any options or call to "par" that will change which axes
are displayed. You can do what you want like this:
plot(...,xaxt="n")
axis(3,...)
unless you want to reverse the direction of the ordinate (y-axis). In
that case, have a look at the revaxis function in the plotrix package.
Jim
More information about the R-help
mailing list