Skip to content

Commit 6bde551

Browse files
author
Lindsay Carr
authored
Merge pull request #369 from jread-usgs/master
frame.plot
2 parents 10c5e4f + 7610479 commit 6bde551

18 files changed

+67
-13
lines changed

R/gather_function_info.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ gather_function_info <- function(object, fun.name, ..., legend.name, side){
2828

2929
object <- apply_extracted_args(object, extracted.args, side=side)
3030

31+
object <- modify_config(object, option.args)
3132
object <- modify_side(object, c(call.args, option.args), side=side)
3233
object <- modify_side_par(object, option.args, side=side)
3334
object <- modify_view_par(object, option.args, side=side)

R/gsplot-class.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ gsplot <- function(x = NULL, ...) UseMethod("gsplot")
1414
#' @rdname gsplot
1515
#' @export
1616
gsplot.default <- function(...) {
17-
object <- gsplot(list())
17+
object <- gsplot(list(global=list('config'=list(frame.plot=TRUE))))
1818
object <- add_new_par(object, 'global')
1919
if (length(list(...)) > 0){
2020
object <- par(object, ...)

R/modify_config.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
#' modify the global config field of the gsplot object
3+
#'
4+
#' @param object a gsplot object
5+
#' @param option.args a list of function calls
6+
#' @return a modified object with the global config field changed
7+
#' @keywords internal
8+
modify_config <- function(object, option.args, field='global'){
9+
config.names <- names(object[[field]]$config)
10+
arguments <- option.args[names(option.args) %in% config.names]
11+
object[[field]]$config <- append_replace(object[[field]]$config, arguments)
12+
return(object)
13+
}

R/print.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ print.gsplot <- function(x, ...){
4242
}
4343

4444
par(x$global$par)
45+
bgCol(x$global$bgCol)
46+
if (x$global$config$frame.plot){
47+
box()
48+
}
49+
title(x$global$title)
4550

46-
bg.arg <- views$global$bgCol
47-
title.arg <- views$global$title
48-
bgCol(bg.arg)
49-
title(title.arg)
5051
view.info <- view_info(views)
5152
side.names <- side_names(views)
5253

71 Bytes
Loading
147 Bytes
Loading
5 Bytes
Loading
142 Bytes
Loading
-7 Bytes
Loading
-176 Bytes
Loading

0 commit comments

Comments
 (0)