Fw: clipping region in ggplot

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Fw: clipping region in ggplot

Oleg Mubarakshin

Sent from my Huawei


Does someone know how to set a clipping region in user coordinates with ggplot?

For example, a clipping area with plot:

x <- 1:5
y <- c(0,1,0,1,0)
plot(x=x, y=y, type="l")
clip(x1=1, x2=5, y1=0.6, y2=1)
polygon(x, y, col=rgb(1, 0, 0, 0.5), border="darkred")
clip(x1=1, x2=5, y1=0, y2=1)
polygon(x, y, col=rgb(1, 0, 0, 0.25), border=NA)

How can I do it with ggplot? Sorry it is not straight about R/Finance...

Oleg Mubarakshin
Senior FX Structurer
Currency Solutions
Tel: +44 (0)207 740 0000
Fax: +44 (0)207 990 8080
Hobbs Court, 2 Jacob Street, London SE1 2BG.

Facebook Twitter Google LinkedIn RSS

Currency Solutions Ltd is registered in England, Company No. 4864491. Her Majesty's Revenue & Customs, No. 12162570. Regulated and authorised by the Financial Conduct Authority as a Payment Institution, No. No. 512130 and as an Investment Firm No. 602082

This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information.

Please consider the environment: think before you print.

[hidden email] mailing list
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.