Re: [R] Problem with axes in a plot of Kaplan-Meier

2012-01-06 Thread Terry Therneau
After changing involuntarily some of the graphics parameters with
the command par() (I did not know that changes with this command are
permanent), now when I made a plot of the survival Kaplan-Meier
function, the Y axis does not start at 1, and the X axis does starts
at 0. The commands that I use are:

-

  Par command are cumulative PER graphics device.  Your unfortunate
par commands would not affect a new plot with pdf() for instance.
I often resort to the simple solution of
dev.off()  #close the current window
x11() # start a new one
(If not on Unix replace x11 with the appropriate command for your
system).

  David's solution is the more elegant one.

Terry T.

__
R-help@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.


[R] Problem with axes in a plot of Kaplan-Meier

2012-01-05 Thread correu griera
Helo:

After changing involuntarily some of the graphics parameters with
the command par() (I did not know that changes with this command are
permanent), now when I made a plot of the survival Kaplan-Meier
function, the Y axis does not start at 1, and the X axis does starts
at 0. The commands that I use are:

library(survival)
BROWN.SPV = Surv(BROWN$TEMPS, BROWN$DEF)
BROWN.KM = survfit(BROWN.SPV ~ 1)
plot(BROWN.KM$time, BROWN.KM$surv, type=s)

How can I restore previous graphics parameters? Is there a file that
would delete to restore the initial settings (already use R in debian
squeeze)?

Thanks a lot. AGriera

__
R-help@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.


Re: [R] Problem with axes in a plot of Kaplan-Meier

2012-01-05 Thread David Winsemius


On Jan 5, 2012, at 12:50 PM, correu griera wrote:


Helo:

After changing involuntarily some of the graphics parameters with
the command par() (I did not know that changes with this command are
permanent), now when I made a plot of the survival Kaplan-Meier
function, the Y axis does not start at 1, and the X axis does starts
at 0. The commands that I use are:

   library(survival)
   BROWN.SPV = Surv(BROWN$TEMPS, BROWN$DEF)
   BROWN.KM = survfit(BROWN.SPV ~ 1)
   plot(BROWN.KM$time, BROWN.KM$surv, type=s)


I would be happy to be proven wrong, but I don't think so. My idea is  
to add this line to your .Rprofile:


myopar - par()

Then you can restore in the future with

par(myopar)

(This is untested and at times I fall on my face with initialization  
assumptions. If the graphics package is not loaded at the  
time .Rprofile is interpreted you might need to run require(graphics)  
before that command.)



The usual practice in a console session (if you remember to do this) is:

opar -par(new-par-specs)
plot-commands
par(opar)

And you should instead be using on.exit if you are writing functions  
to do this.




How can I restore previous graphics parameters? Is there a file that
would delete to restore the initial settings (already use R in debian
squeeze)?



--

David Winsemius, MD
West Hartford, CT

__
R-help@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.