Skip to content
Back to formatted view

Raw Message

Message-ID: <8414A54B-AC90-46BB-97F1-E17F0948857A@me.com>
Date: 2020-10-26T14:52:21Z
From: Marc Schwartz
Subject: temporary clipping
In-Reply-To: <28fddd$eq1h4n@ironport10.mayo.edu>

> On Oct 26, 2020, at 10:02 AM, Therneau, Terry M., Ph.D. via R-help <r-help at 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