The R Project SVN R

Rev

Rev 80166 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80166 Rev 80951
Line 1... Line 1...
1
#### Regression tests for GRAPHICS & PLOTS
1
#### Regression tests for GRAPHICS & PLOTS -- requiring strict PDF equality
2
 
2
 
3
pdf("reg-plot.pdf", paper="a4r", encoding ="ISOLatin1.enc", compress = FALSE,
3
pdf("reg-plot.pdf", paper="a4r", encoding ="ISOLatin1.enc", compress = FALSE,
4
    useDingbats = TRUE)
4
    useDingbats = TRUE)
5
 
5
 
6
## since we supply the font metrics, the results depend only on
6
## since we supply the font metrics, the results depend only on
Line 241... Line 241...
241
dotchart(VADeaths[1:2, 1:3], color=g, pch=g,
241
dotchart(VADeaths[1:2, 1:3], color=g, pch=g,
242
         ylab = "Grouping:  {Urbanity . Gender} x Age",
242
         ylab = "Grouping:  {Urbanity . Gender} x Age",
243
         xaxt="n", frame.plot=FALSE)
243
         xaxt="n", frame.plot=FALSE)
244
## now pch and colors match groups;
244
## now pch and colors match groups;
245
## ylab placement; group (row) labels show again
245
## ylab placement; group (row) labels show again
-
 
246
 
-
 
247
 
-
 
248
## non-integer mgp[3] -- PR#18194
-
 
249
par(mar = c(5, 5, 5, 5))
-
 
250
plot.new()
-
 
251
plot.window(xlim = c(0, 5), ylim = 0:1)
-
 
252
if(dev.interactive()) {
-
 
253
    box(lty = 3)
-
 
254
    ## 'axis' puts line and labels in right place when 'mgp[3]' is integer
-
 
255
    mgp_bottom <- c(4, 2.5, 1) # 'mgp[1]' is arbitrary
-
 
256
    axis(1, at=c(1,4), mgp = mgp_bottom)
-
 
257
    mtext(c("labels", "line"), side = 1, line = mgp_bottom[2:3])
-
 
258
}
-
 
259
## Now, 'axis' puts line & labels in right place also when 'mgp[3]' is noninteger:
-
 
260
mgp_top <- c(4, 2.5, 0.9)
-
 
261
axis(3, at=c(1,4), mgp = mgp_top)
-
 
262
mtext(c("labels are here", "line"), line = mgp_top[2:3])
-
 
263
## They were one line too high in R <= 4.1.1