Skip to content

Commit 9667346

Browse files
committed
svg bug
replaced svg calls with pdf
1 parent 3e6c07e commit 9667346

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export(CPLparsToHinges)
2222

2323

2424
importFrom(graphics, plot, axis, image, legend, lines, par, polygon, text)
25-
importFrom(grDevices, colorRampPalette, svg)
25+
importFrom(grDevices, colorRampPalette)
2626
import(mathjaxr)
2727
importFrom(stats, approx, dcauchy, dlnorm, dnorm, dunif, qbeta, qgamma, quantile, rnorm, sd)
2828
importFrom(scales, alpha)

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
# ADMUR build history
99

10+
### Version: 1.0.2.9002
11+
12+
## 2021-03-19
13+
* svg replaced with pdf to resolve request from Pof Brian Ripley.
14+
1015
## 2021-01-22
1116

1217
### Version: 1.0.2.9001

vignettes/guide.Rmd

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ Generating a single calibrated date distribution or SPD requires either a two-st
8484

8585
1. Use the function [summedCalibratorWrapper()](../html/summedCalibratorWrapper.html)
8686

87-
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
87+
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
8888
data <- data.frame( age=c(6562,7144), sd=c(44,51) )
8989
x <- summedCalibratorWrapper(data)
9090
```
9191

9292
Notice the function assumes the data provided were all ^14^C dates. However, if you have other kinds of date such as thermoluminescence you can specify this. Non-^14^C types are assumed to be in calendar time, BP. You can also specify a particular calibration curve:
9393

94-
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
94+
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
9595
data <- data.frame( age=c(6562,7144), sd=c(44,51), datingType=c('14C','TL') )
9696
x <- summedCalibratorWrapper(data=data, calcurve=shcal20)
9797
```
@@ -105,7 +105,7 @@ Generating the SPD without the wrapper gives you more control, and requires a tw
105105

106106
This is useful for improving computational times if generating many SPDs, for example in a simulation framework, since the CalArray needs generating only once.
107107

108-
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
108+
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
109109
data <- data.frame( age = c(9144), sd=c(151) )
110110
CalArray <- makeCalArray( calcurve=intcal20, calrange=c(8000,13000) )
111111
cal <- summedCalibrator(data, CalArray)
@@ -155,7 +155,7 @@ data[,2:7]
155155
The data have not already been phased (do not include a column 'phase') therefore the default binning algorithm calibrates these dates into four phases. this is achieved by binning dates that have a mean ^14^C date within 200 ^14^C years of any other date in that respective bin. Therefore Pacopampa.1 comprises samples 1207 and 1206, Pacopampa.2 comprises sample 1205, Carrizal.1 comprises samples 1196 and 1195 and 1194 and 1193, and Carrizal.2 comprises sample 1192:
156156

157157

158-
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
158+
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
159159
CalArray <- makeCalArray( calcurve=shcal20, calrange=c(2000,6000) )
160160
x <- phaseCalibrator(data=data, CalArray=CalArray)
161161
plotPD(x)
@@ -172,7 +172,7 @@ SPD <- SPD/( sum(SPD) * CalArray$inc )
172172

173173
Alternatively, the wrapper function [summedPhaseCalibrator()](../html/summedPhaseCalibrator.html) will perform this entire workflow internally:
174174

175-
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
175+
```{r, eval = TRUE, fig.height = 3, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
176176
SPD <- summedPhaseCalibrator( data=data, calcurve=shcal20, calrange=c(2000,6000) )
177177
plotPD(SPD)
178178
```
@@ -280,7 +280,7 @@ best <- JDEoptim(lower = rep(0,5),
280280
load('vignette.3CPL.JDEoptim.best.RData')
281281
```
282282

283-
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
283+
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
284284
CPL <- CPLparsToHinges(pars=best$par, years=5500:7500)
285285
SPD <- summedPhaseCalibrator( data=data, calcurve=shcal20, calrange=c(5500,7500) )
286286
plotPD(SPD)
@@ -376,7 +376,7 @@ An exponential curve between n=200 and n=1 across the same 100 years has a decli
376376
Meanwhile a linear model between n=200 and n=1 across the same 100 years has an expected decline rate of 47.835% loss per generation.
377377

378378
The relationship between the conventional rate and relative rate is almost identical for realistic rates of change (c. -10% to +10% per generation):
379-
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
379+
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
380380
N <- 1000
381381
x <- cbind(rep(5100,N),rep(5000,N))
382382
y <- cbind(seq(1,100,length.out=N),seq(100,1,length.out=N))
@@ -435,7 +435,7 @@ data.frame(BIC.1,BIC.2,BIC.3,BIC.4,BIC.exp,BIC.uniform)
435435

436436
Clearly the 4-CPL has the highest likelihood, however the 3-CPL model has the lowest BIC and is selected as the best. This tells us that the 4-CPL is overfitted to the data and is unjustifiably complex, whilst the other models are underfitted and lack explanatory power. Nevertheless for comparison we can plot all the competing models, illustrating that the 4-CPL fits the closest, but cannot warn us that it is overfit:
437437

438-
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
438+
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
439439
# convert parameters to model PDs
440440
CPL1 <- convertPars(pars=CPL.1$par, years=5500:7500, type='CPL')
441441
CPL2 <- convertPars(pars=CPL.2$par, years=5500:7500, type='CPL')
@@ -473,7 +473,7 @@ The test provides a p-value of 1.00 for the best model (3-CPL), since all of the
473473
load('vignette.3CPL.SPDsimulationTest.RData')
474474
```
475475

476-
```{r, eval = TRUE, fig.height = 5, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
476+
```{r, eval = TRUE, fig.height = 5, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
477477
print(summary$pvalue)
478478
hist(summary$simulated.stat, main='Summary statistic', xlab='')
479479
abline(v=summary$observed.stat, col='red')
@@ -580,7 +580,7 @@ The function [plotSimulationSummary()](../html/plotSimulationSummary.html) then
580580
load('vignette.exp.SPDsimulationTest.RData')
581581
```
582582

583-
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='svg', warning=FALSE, message=FALSE}
583+
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE, message=FALSE}
584584
plotSimulationSummary(summary, legend.y=0.0012)
585585
```
586586

@@ -764,7 +764,7 @@ load('vignette.3CPL.JDEoptim.best.RData')
764764
load('vignette.3CPL.JDEoptim.best.taph.RData')
765765
```
766766

767-
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
767+
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
768768
CPL <- convertPars(pars=best$par, years=5500:7500, type='CPL', taphonomy=F)
769769
CPL.taph <- convertPars(pars=best.taph$par, years=5500:7500, type='CPL', taphonomy=T)
770770
@@ -776,7 +776,7 @@ legend(x=6300,y=0.001,legend=c('3-CPL','3-CPL with taphonomy'),bty='n',col=cols[
776776
```
777777

778778
The above *3-CPL with taphonomy* model represents a conflation of two model components: the population dynamics and the taphonomic loss. Instead we are interested in separating these components:
779-
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='svg', warning=FALSE}
779+
```{r, eval = TRUE, fig.height = 4, fig.width=7, fig.align = "center", dev='pdf', warning=FALSE}
780780
pop <- convertPars(pars=best.taph$par[1:5], years=5500:7500, type='CPL')
781781
taph <- convertPars(pars=best.taph$par[6:7], years=5500:7500, type='power')
782782
plotPD(pop)

vignettes/replicating-timpson-rstb.2020.Rmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Generate plot:
9797
library(ADMUR)
9898
load('results.RData')
9999
oldpar <- par(no.readonly = TRUE)
100-
svg('Fig1.svg',height=4,width=10)
100+
pdf('Fig1.pdf',height=4,width=10)
101101
par(mar=c(2,4,0.1,2))
102102
plot(NULL, xlim=c(7500,5500), ylim=c(0,0.0011), xlab='', ylab='', xaxs='i',cex.axis=0.7, bty='n',las=1)
103103
axis(1,at=6400,labels='calBP',tick=F)
@@ -337,7 +337,7 @@ Generate plot:
337337
oldpar <- par(no.readonly = TRUE)
338338
339339
# Fig 2 plot
340-
svg('Fig2.svg',height=6,width=13)
340+
pdf('Fig2.pdf',height=6,width=13)
341341
layout(mat=matrix(1:14, 2, 7, byrow = F),widths=c(0.3,rep(1,6)), heights=c(1,1.5),respect=T)
342342
343343
# plot two blanks first
@@ -430,7 +430,7 @@ Generate plot:
430430
library(ADMUR)
431431
load('results.RData')
432432
oldpar <- par(no.readonly = TRUE)
433-
svg('Fig4.svg',height=4,width=10)
433+
pdf('Fig4.pdf',height=4,width=10)
434434
par(mar=c(2,4,0.1,0.1))
435435
plotSimulationSummary(summary, legend.x=11500,legend.y=0.0003)
436436
axis(side=1, at=2500,labels='calBP',tick=F)
@@ -507,7 +507,7 @@ Generate plot:
507507

508508
```{r, eval = FALSE}
509509
oldpar <- par(no.readonly = TRUE)
510-
svg('Fig5.svg',height=4,width=10)
510+
pdf('Fig5.pdf',height=4,width=10)
511511
par(mfrow=c(1,2))
512512
513513
# model comparison
@@ -599,7 +599,7 @@ Generate Figure 6:
599599

600600
```{r, eval = FALSE}
601601
oldpar <- par(no.readonly = TRUE)
602-
svg('Fig6.svg',height=5,width=11)
602+
pdf('Fig6.pdf',height=5,width=11)
603603
par(mfrow=c(2,3))
604604
lwd <- 3
605605
red='firebrick'
@@ -631,7 +631,7 @@ Generate Figure 7:
631631

632632
```{r, eval = FALSE}
633633
oldpar <- par(no.readonly = TRUE)
634-
svg('Fig7.svg',height=5,width=12)
634+
pdf('Fig7.pdf',height=5,width=12)
635635
grey1 <- 'grey90'
636636
grey2 <- 'grey70'
637637
grey3 <- 'grey50'

0 commit comments

Comments
 (0)