Assume I want to put this into a function, how do I redefine the margins to fit better.

I did par(mar=c(4.1,4.1,5.1,2.1) inside the function, but then it is not possible anymore to change them, I just want to change the default for this plotting function, how ?

#----------------------------------------------------------
#Function to be improved
#-----------------------------------------------------
plot.revy <- function(x,y,...)
  {
    plot(x,y,ylim=rev(range(y)),axes = FALSE,...)
    axis(2)
    axis(3)
    box()
  }

Ross Ihaka wrote:

XIAO LIU wrote:

R users:

I want X-Y plotting with axes in reverse direction such as (0, -1, -2, -3, ....). How can I do it?

Thanks in advance


Use the xlim and ylim arguments to plot.

    x = -(1:10)
    y = rnorm(10)

    # Standard plot
    plot(x, y)

    # Reversed x-axis
    plot(x, y, xlim=rev(range(x)))


______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to