Skip to content

Commit 5ec1d0b

Browse files
author
Jordan S Read
committed
updates to def.funs
1 parent d5c87c2 commit 5ec1d0b

File tree

8 files changed

+8
-8
lines changed

8 files changed

+8
-8
lines changed

R/abline.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ abline <- function(object, ...) {
2828

2929

3030
abline.gsplot <- function(object, ..., legend.name=NULL, side=c(1,2)){
31-
set_window_args(object, fun.name='abline', ..., legend.name=legend.name, side=side, def.funs=graphics::abline)
31+
set_window_args(object, fun.name='abline', ..., legend.name=legend.name, side=side, def.funs=c(graphics::abline, graphics::plot.xy))
3232
}

R/par_arguments.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ par_arguments <- function(arguments, def.funs){
77
NULL
88
}
99

10-
formal_arguments <- function(arguments, def.funs){
10+
formal_arguments <- function(arguments, def.funs, keep.names=NULL){
1111
if (length(def.funs) > 1)
12-
formal_names <- unique(unlist(lapply(def.funs, function(x)names(formals(x)))))
12+
formal.names <- unique(unlist(lapply(def.funs, function(x)names(formals(x)))))
1313
else
14-
formal_names <- names(formals(def.funs))
15-
args = arguments[names(arguments) %in% formal_names]
14+
formal.names <- names(formals(def.funs))
15+
args = arguments[names(arguments) %in% formal.names | names(arguments) %in% keep.names]
1616
if (length(args) > 0)
1717
return(args)
1818
else

R/set_args.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ set_window_args <- function(object, fun.name, ..., legend.name=NULL, side=c(1,2)
2626
else
2727
arguments = set_args(fun.name, package=package)
2828
e.fun = dots$e.fun
29-
to.gsplot <- list(list(arguments = append(formal_arguments(arguments, def.funs), window_arguments(arguments, def.funs)),
29+
to.gsplot <- list(list(arguments = append(formal_arguments(arguments, def.funs, names(config(fun.name))), window_arguments(arguments, def.funs)),
3030
gs.config=list(legend.name = legend.name, side = side, par=par_arguments(arguments, def.funs)))) %>%
3131
setNames(fun.name)
3232

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ demoPlot <- gsplot() %>%
3838
abline(b=1, a=0, legend.name="1:1") %>%
3939
axis(side=c(3,4), labels=FALSE) %>%
4040
legend(location="topleft",title="Awesome!") %>%
41-
# grid() %>%
41+
grid() %>%
4242
error_bar(x=1:3, y=c(3,1,2), y.high=c(0.5,0.25,1), y.low=0.1) %>%
4343
error_bar(x=1:3, y=c(3,1,2), x.low=.2, x.high=.2, col="red",lwd=3) %>%
4444
callouts(x=1, y=2.8, lwd=2, angle=250, labels="Weird data") %>%

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ demoPlot <- gsplot() %>%
3333
abline(b=1, a=0, legend.name="1:1") %>%
3434
axis(side=c(3,4), labels=FALSE) %>%
3535
legend(location="topleft",title="Awesome!") %>%
36-
# grid() %>%
36+
grid() %>%
3737
error_bar(x=1:3, y=c(3,1,2), y.high=c(0.5,0.25,1), y.low=0.1) %>%
3838
error_bar(x=1:3, y=c(3,1,2), x.low=.2, x.high=.2, col="red",lwd=3) %>%
3939
callouts(x=1, y=2.8, lwd=2, angle=250, labels="Weird data") %>%
3.38 KB
Loading
346 Bytes
Loading
-5.88 KB
Loading

0 commit comments

Comments
 (0)