[R-sig-eco] Help with R command 'probPlot' from the 'smwrGraphs' package

Sarah Goslee sarah.goslee at gmail.com
Thu Apr 26 18:13:25 CEST 2018


Hi Adam,

I took a look at the package, and it appears they want you to use
setPDF() instead of pdf() - their own custom graphics function,
instead of the generic one.

This is in the help for probPlot. There's also a vignette mentioned
that may give you more assistance.

But also, I tried a regular pdf() with some sample data and didn't get
any error messages.

If that doesn't help, here are some things you can do to ensure that
you get a useful answer:

1. Don't post in HTML. You'll notice that your post below is rather
mangled. Posting in plain text ensures that doesn't happen.

2. Provide a reproducible example - we can't try your code, because we
don't have your data. Providing fake data is fine, as in the help for
probPlot.

3. Include your sessionInfo() - this sounds like it might be a
Windows-specific problem, but we don't know that. My session info is
below.

Sarah


> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 26 (Workstation Edition)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] smwrGraphs_1.1.4 smwrBase_1.1.5   lubridate_1.7.4  setwidth_1.0-4
[5] colorout_0.9-9

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.16       lattice_0.20-35    digest_0.6.13      withr_2.1.1
 [5] grid_3.4.3         R6_2.2.2           git2r_0.20.0       magrittr_1.5
 [9] KernSmooth_2.23-15 httr_1.3.1         stringi_1.1.7      curl_3.1
[13] sp_1.2-5           akima_0.6-2        devtools_1.13.4    tools_3.4.3
[17] stringr_1.3.0      compiler_3.4.3     tcltk_3.4.3        memoise_1.1.0
[21] knitr_1.17






On Thu, Apr 26, 2018 at 11:20 AM, Stonewall, Adam <stonewal at usgs.gov> wrote:
> Howdy,
>
> I'm a novice R coder, so apologies in advance if I'm not asking this
> question in a straightforward manner or am neglecting needed information.
>
> I'm having trouble producing .pdf plots using the R command 'probPlot' from
> the 'smwrGraphs' package (a USGS package).
>
> The script:
>
>  *par(las=1)*
> * probPlot(DCC1, FLIP=T, xtitle = "Exceedance Probability",*
> *          ytitle= paste0(NCon1," concentration in mg/L"),*
> *          margin = c (4, 4, 4, 4))*
> * title(main=paste(run, NCon1))*
> * abline(h = log10(TPStand), lty=3)*
>
> works fine, and produces a plot on the screen as I would expect. However,
> if I use the 'pdf' command with this script:
>
>  *pdf(paste0(run,NCon1,".pdf"),height=10,width=10)*
> * par(las=1)*
> * probPlot(DCC1, FLIP=T, xtitle = "Exceedance Probability",*
> *          ytitle= paste0(NCon1," concentration in mg/L"),*
> *          margin = c (4, 4, 4, 4))*
> * title(main=paste(run, NCon1))*
> * abline(h = log10(TPStand), lty=3)*
> * dev.off()*
>
> I get wildly inconsistent results. On rare occasion it seems to work for no
> reason. But the most common error script is:
>
>> pdf(paste0(run,NCon1,".pdf"),height=10,width=10)
>>  par(las=1)
>>  probPlot(DCC1, FLIP=T, xtitle = "Exceedance Probability",
> +           ytitle= paste0(NCon1," concentration in mg/L"),
> +           margin = c (4, 4, 4, 4))
> Error in mtext(text = labels, side = 2L, at = pretty$labelpos, line = 0.2,
> :
>   invalid font type
> In addition: There were 20 warnings (use warnings() to see them)
>>  title(main=paste(run, NCon1))
> Error in title(main = paste(run, NCon1)) : invalid font type
> In addition: Warning messages:
> 1: In title(main = paste(run, NCon1)) :
>   font family 'USGS' not found in PostScript font database
> 2: In title(main = paste(run, NCon1)) :
>   font family 'USGS' not found in PostScript font database
> 3: In title(main = paste(run, NCon1)) :
>   font family 'USGS' not found in PostScript font database
> 4: In title(main = paste(run, NCon1)) :
>   font family 'USGS' not found in PostScript font database
> 5: In title(main = paste(run, NCon1)) :
>   font family 'USGS' not found in PostScript font database
>>  abline(h = log10(TPStand), lty=3)
>>  dev.off()
> RStudioGD
>         2
>
> Anyone have any advice or suggestions?
> Thanks,
> Adam
>
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-sig-ecology mailing list