plothistory.Rmd
The plothistory
package enables one to store all plots
generated during a session in a user-defined directory, alike all
commands stored in the .Rhistory
file. These directories
can be reused across different sessions to keep storing plots.
library(plothistory)
Three directories can be used:
tempdir()
, using the
phist_tmp_dir()
function. This temporary directory is
deleted once the R session closes.## Plot history set to
## /tmp/RtmpwN73V6
phist_cache_dir()
function.## Plot history set to
## /home/runner/.cache/R/plothistory
phist_dir()
.## Plot history set to
## /home/runner/work/plothistory/plothistory/vignettes
In each case, the function will first check if the directory exists,
and created if required. The user will be asked to confirm whether the
central cache directory should be created the first time
phist_cache_dir()
is used.
The storage of all plots is initiated by the
plothistory()
function. By default, it will use a temporary
directory, but the above functions can be functions can be passed to
plothistory()
to change this behaviour.
## Plot history set to
## /tmp/RtmpwN73V6
## httpgd server running at:
## http://127.0.0.1:43425/live?token=BTJyUwJt
The plots are generated using the httpgd graphics device and can
be seen at the URL shown above. Each plot is now copied in the directory
defined in plothistory()
.
Here are two short videos that illustrate the package’s usage:
plothistory()
with the
package cache directory
For more details on how this works, see the plothistory()
manual page online or with ?plothistory
.
## R version 4.3.3 (2024-02-29)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.4 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0
##
## locale:
## [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
## [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
## [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
## [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
##
## time zone: UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] plothistory_0.1.3
##
## loaded via a namespace (and not attached):
## [1] vctrs_0.6.5 cli_3.6.2 knitr_1.45 rlang_1.1.3
## [5] xfun_0.43 purrr_1.0.2 textshaping_0.3.7 jsonlite_1.8.8
## [9] htmltools_0.5.8 ragg_1.3.0 sass_0.4.9 rmarkdown_2.26
## [13] evaluate_0.23 jquerylib_0.1.4 fastmap_1.1.1 yaml_2.3.8
## [17] lifecycle_1.0.4 memoise_2.0.1 compiler_4.3.3 fs_1.6.3
## [21] Rcpp_1.0.12 websocket_1.4.1 later_1.3.2 httpgd_2.0.1
## [25] systemfonts_1.0.6 digest_0.6.35 R6_2.5.1 unigd_0.1.1
## [29] magrittr_2.0.3 bslib_0.7.0 tools_4.3.3 pkgdown_2.0.7
## [33] cachem_1.0.8 desc_1.4.3