-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClipPath.Rmd
More file actions
executable file
·63 lines (55 loc) · 1.22 KB
/
ClipPath.Rmd
File metadata and controls
executable file
·63 lines (55 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
title: "ClipPath"
output:
html_document:
toc: true
theme: united
---
```{r, echo=FALSE}
stopifnot(require(svgR, quietly=TRUE))
```
With a defs clipPath works seamlessly, but
```{r, echo=T, results="asis"}
#```{r, echo=T}
WH=c(600, 100) # window rect
svgR( wh=WH,
defs(
clipPath(
id="clip0",
rect(cxy=c(0,50), wh=c(600,50))
)
),
g( clip.path="url(#clip0)",
circle( cxy=c(50,50), r=30, fill='darkblue'),
circle( cxy=c(150,50), r=50, fill='red' )
)
)
```
```{r, echo=T, results="asis"}
#```{r, echo=T}
WH=c(600, 100) # window rect
svgR( wh=WH,
g(
clip.path=clipPath( rect(cxy=c(0,50), wh=c(600,50))),
circle( cxy=c(50,50), r=30, fill='darkblue'),
circle( cxy=c(150,50), r=50, fill='red' )
)
)
```
**Note** removing the defs, we see that it works in firefox, chromium, but not in the RStudio browser on Ubuntu.
```{r, echo=T, results="asis"}
#```{r, echo=T}
WH=c(600, 100) # window rect
svgR( wh=WH,
#defs(
clipPath(
id="clip1",
rect(cxy=c(0,50), wh=c(600,50))
#)
),
g( clip.path="url(#clip1)",
circle( cxy=c(50,50), r=30, fill='green'),
circle( cxy=c(150,50), r=50, fill='orange')
)
)
```