amvillegas / StMoMo

Stochastic Mortality Modelling
21 stars 6 forks source link

Problems with the par option of residual plots #1

Closed amvillegas closed 9 years ago

amvillegas commented 9 years ago

When using function \code{plot} for objects of class "resStMoMo" with type = "heatmap" the margins of subsequent plots are corrupted. See this code for an example

  CBDfit <- fit(cbd(), Dxt = EWMaleData$Dxt, Ext = EWMaleData$Ext,
              ages = EWMaleData$ages, years = EWMaleData$years,
              ages.fit = 55:89)
   CBDres <- residuals(CBDfit)
   plot(CBDres, type = "colourmap", reslim = c(-3.5,3.5))
   plot(CBDres, type = "scatter", reslim = c(-3.5,3.5))
   plot(CBDres, type = "scatter", reslim = c(-3.5,3.5))

A possible solution is to set use the code oldpar <- par(no.readonly = TRUE) and par(oldpar) before and after doing a residual plot