The R Project SVN R

Rev

Rev 52082 | Rev 52784 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 52082 Rev 52410
Line 1... Line 1...
1
 
1
 
2
R version 2.12.0 Under development (unstable) (2010-04-14 r51721)
2
R version 2.12.0 Under development (unstable) (2010-06-28 r52408)
3
Copyright (C) 2010 The R Foundation for Statistical Computing
3
Copyright (C) 2010 The R Foundation for Statistical Computing
4
ISBN 3-900051-07-0
4
ISBN 3-900051-07-0
5
 
5
 
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
6
R is free software and comes with ABSOLUTELY NO WARRANTY.
7
You are welcome to redistribute it under certain conditions.
7
You are welcome to redistribute it under certain conditions.
Line 2122... Line 2122...
2122
> 
2122
> 
2123
> 
2123
> 
2124
> 
2124
> 
2125
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
2125
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
2126
> cleanEx()
2126
> cleanEx()
-
 
2127
> nameEx("polypath")
-
 
2128
> ### * polypath
-
 
2129
> 
-
 
2130
> flush(stderr()); flush(stdout())
-
 
2131
> 
-
 
2132
> ### Name: polypath
-
 
2133
> ### Title: Path Drawing
-
 
2134
> ### Aliases: polypath
-
 
2135
> ### Keywords: aplot
-
 
2136
> 
-
 
2137
> ### ** Examples
-
 
2138
> 
-
 
2139
> plotPath <- function(x, y, col="grey", rule="winding") {
-
 
2140
+     plot.new()
-
 
2141
+     plot.window(range(x, na.rm=TRUE), range(y, na.rm=TRUE))
-
 
2142
+     polypath(x, y, col=col, rule=rule)
-
 
2143
+     if (!is.na(col))
-
 
2144
+         mtext(paste("Rule:", rule), side=1, line=0)
-
 
2145
+ }
-
 
2146
> 
-
 
2147
> plotRules <- function(x, y, title) {
-
 
2148
+     plotPath(x, y)
-
 
2149
+     plotPath(x, y, rule="evenodd")
-
 
2150
+     mtext(title, side=3, line=0)
-
 
2151
+     plotPath(x, y, col=NA)
-
 
2152
+ }
-
 
2153
> 
-
 
2154
> op <- par(mfrow=c(5, 3), mar=c(2, 1, 1, 1))
-
 
2155
> 
-
 
2156
> plotRules(c(.1, .1, .9, .9, NA, .2, .2, .8, .8),
-
 
2157
+           c(.1, .9, .9, .1, NA, .2, .8, .8, .2),
-
 
2158
+           title="Nested rectangles, both clockwise")
-
 
2159
> plotRules(x=c(.1, .1, .9, .9, NA, .2, .8, .8, .2),
-
 
2160
+           y=c(.1, .9, .9, .1, NA, .2, .2, .8, .8),
-
 
2161
+           title="Nested rectangles, outer clockwise, inner anti-clockwise")
-
 
2162
> plotRules(x=c(.1, .1, .4, .4, NA, .6, .9, .9, .6),
-
 
2163
+           y=c(.1, .4, .4, .1, NA, .6, .6, .9, .9),
-
 
2164
+           title="Disjoint rectangles")
-
 
2165
> plotRules(x=c(.1, .1, .6, .6, NA, .4, .4, .9, .9),
-
 
2166
+           y=c(.1, .6, .6, .1, NA, .4, .9, .9, .4),
-
 
2167
+           title="Overlapping rectangles, both clockwise")
-
 
2168
> plotRules(x=c(.1, .1, .6, .6, NA, .4, .9, .9, .4),
-
 
2169
+           y=c(.1, .6, .6, .1, NA, .4, .4, .9, .9),
-
 
2170
+           title="Overlapping rectangles, one clockwise, other anti-clockwise")
-
 
2171
> 
-
 
2172
> par(op)
-
 
2173
> 
-
 
2174
> 
-
 
2175
> 
-
 
2176
> graphics::par(get("par.postscript", pos = 'CheckExEnv'))
-
 
2177
> cleanEx()
2127
> nameEx("raster")
2178
> nameEx("raster")
2128
> ### * raster
2179
> ### * raster
2129
> 
2180
> 
2130
> flush(stderr()); flush(stdout())
2181
> flush(stderr()); flush(stdout())
2131
> 
2182
>