[R] temporary clipping

Marc Schwartz m@rc_@chw@rtz @end|ng |rom me@com
Mon Oct 26 15:52:21 CET 2020


> On Oct 26, 2020, at 10:02 AM, Therneau, Terry M., Ph.D. via R-help <r-help using r-project.org> wrote:
> 
> In one of my plot functions it is convenient to use clipping to restrict the range of some 
> output.
> But at the end of the function I'd like to turn it off, i.e., so that a subsequent use of 
> legend(), text() or whatever is not affected.
> I don't quite see how to do this -- it seems that the only way to turn off clip is with a 
> new plot.


Terry,

At the end of the example on ?clip, there is:

  do.call("clip", as.list(usr))  # reset to plot region

where 'usr' is the value of:

  usr <- par("usr")

called after the very first plot is generated.

The indication is that by using the final line of code in the example, the clipping region is reset to the plot region, probably also based upon any change to par("xpd") that may be relevant in your use case.

Does that help?

Regards,

Marc Schwartz



More information about the R-help mailing list