I "programmed" round the problem by moving all the writing of "pretty" text to
the ends of the respective functions, and including the line limits <-
par("usr") after each call to plot within the if - else constructs I was using.
That causes the correct values of "usr" to be present where and when I needed
them at the end of the functions.
I have no idea why this works, but it may be a useful wrinkle for S-Newsers to
know.
Bob
> ----------
> From: Garrett, Robert
> Sent: July 26, 2006 10:23 AM
> To: 'S-News'
> Subject: par("usr")
>
> I am using S+ 6.2 (Build 6713) under Win 2K on an IBM laptop (500MB)
>
> I am trying to "pretty up" some graphics, by adding annotation within the
> plot frame. When using par("usr") to get the coordinates of the plot frame I
> sometimes get an erroneous value for par("usr")[3], the y coordinate of the
> lower x-axis of the plot.
>
> This seems to relate to when I plot only part of the data for an ecdf, but
> not a cumulative probability plot. However, within my ecdf function I do not
> call plot until after I have selected the subset of data to be plotted, The
> lower x-axis plots at a y-coordinate of about 0.1, just as I expect, but
> par("usr")[3] returns a value of 0.03, which is what I would expect for the
> total data. So I am bemused and befuddled.
>
> Has this behaviour ever been seen before, or what is the stupid mistake I am
> making?
>
> Any help would be appreciated,
>
>
> Robert G. (Bob) Garrett Robert G. (Bob) Garrett
> Emeritus scientist scientique émérite
> Geological Survey of Canada Commission géologique du Canada
> Natural Resources Canada Ressources naturelles Canada
> 601 Booth St., Ottawa, Ontario 601 rue Booth, Ottawa (Ontario)
> Canada K1A 0E8 Canada K1A 0E8
> Email: garrett@NRCan.gc.ca Email: garrett@NRCan.gc.ca
> Tel.: 613+995-4517 Tel.: 613+995-4517
> FAX: 613+996-3726 FAX: 613+996-3726
> ------------------------------------------------------------------------------------------------------
>
>
|