Skip to content

Commit

Permalink
responses to review
Browse files Browse the repository at this point in the history
  • Loading branch information
ldecicco-USGS committed Aug 16, 2016
1 parent c287996 commit 272cede
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 41 deletions.
14 changes: 7 additions & 7 deletions R/config.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
gsconfig <- new.env(parent = emptyenv())
gsconfig$orignial.par <- par(no.readonly = TRUE)
gsconfig$original.par <- par(no.readonly = TRUE)

#' @title Load gsplot config
#'
Expand All @@ -24,8 +24,8 @@ loadConfig = function(filename) {

graphTemplate <- yaml.load_file(filename)

if(length(all.equal(gsconfig$orignial.par, par(no.readonly = TRUE))) > 1){
par(gsconfig$orignial.par)
if(length(all.equal(gsconfig$original.par, par(no.readonly = TRUE))) > 1){
par(gsconfig$original.par)
}
gsconfig$options <- graphTemplate
}
Expand All @@ -44,12 +44,12 @@ loadConfig = function(filename) {
#' @importFrom grDevices dev.off
load_temp_config = function(filename) {

gsconfig$orignial.par <- par(no.readonly = TRUE)
gsconfig$original.par <- par(no.readonly = TRUE)

graphTemplate <- yaml.load_file(filename)

if(length(all.equal(gsconfig$orignial.par, par(no.readonly = TRUE))) > 1){
par(gsconfig$orignial.par)
if(length(all.equal(gsconfig$original.par, par(no.readonly = TRUE))) > 1){
par(gsconfig$original.par)
}
gsconfig$temp.config <- graphTemplate
}
Expand All @@ -63,7 +63,7 @@ load_temp_config = function(filename) {
#' @param type string of gsplot config object to retrieve
#' @param ... additional configuration to override what is pulled from config
#' @param persist logical of whether to persist overrides to config
#' @param custom.config logical of whether to use default global (TRUE) or a config set for only one gsplot object
#' @param custom.config logical of whether to use default global (FALSE) or a config set for only one gsplot object
#'
#' @examples
#' config("par")
Expand Down
4 changes: 2 additions & 2 deletions R/gsplot-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ gsplot.default <- function(...,config.file=NA, theme=NA) {
load_temp_config(config.file)
}

if(length(all.equal(gsconfig$orignial.par, par(no.readonly = TRUE))) > 1){
par(gsconfig$orignial.par)
if(length(all.equal(gsconfig$original.par, par(no.readonly = TRUE))) > 1){
par(gsconfig$original.par)
}

object <- add_new_par(object, 'global')
Expand Down
2 changes: 2 additions & 0 deletions R/legend.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ draw_legend <- function(gsplot) {
} else {
par(bg = ifelse(par('bg') == "transparent", "#FFFFFF", par('bg')))
}
legend <- lapply(legend, function(x) {unname(sapply(x, function(x) {eval(x)}))})

# clean out arguments not allowed by legend
legend <- legend[na.omit(match(names(default.args), names(legend)))]
legend(legend)
Expand Down
Binary file modified README_files/figure-markdown_github/unnamed-chunk-5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 1 addition & 31 deletions inst/doc/gsplotIntro.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion man/config.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 272cede

Please sign in to comment.