@@ -81,13 +81,11 @@ set_legend_args <- function(object, fun.name, ..., legend.name) {
8181 paramsAll <- set_type_params(paramsAll , type.name , params.needed )
8282 if (type.name %in% c(' p' , ' lchsS' )) {fun.name <- switch (type.name , p = " points" , lchsS = " lines" )}
8383 }
84-
85- usr.args <- paramsAll [which(names(paramsAll ) %in% names(fun.default ))]
86-
84+
8785 if (fun.name == " points" ) {
8886 pt.names <- c(" lwd" ," bg" ," cex" )
89- names(usr.args ) <- replace(names(usr.args ), which(names(usr.args ) %in% pt.names ),
90- paste0(" pt." , pt.names [which(pt.names %in% names(usr.args ))]))
87+ names(paramsAll ) <- replace(names(paramsAll ), which(names(paramsAll ) %in% pt.names ),
88+ paste0(" pt." , pt.names [which(pt.names %in% names(paramsAll ))]))
9189 fun.specific <- list (border = quote(par(" bg" )),
9290 pch = 1 ,
9391 pt.bg = quote(par(" bg" )),
@@ -100,12 +98,13 @@ set_legend_args <- function(object, fun.name, ..., legend.name) {
10098 lwd = 1 )
10199
102100 } else if (fun.name %in% c(" polygon" , " rect" )) {
103- names(usr.args ) <- replace(names(usr.args ), which(names(usr.args )== " col" ), " fill" )
104- usr.args $ lty <- NA # lty/lwd should always be NA for polygon & rectangles in the legend
105- usr.args $ lwd <- NA
101+ names(paramsAll ) <- replace(names(paramsAll ), which(names(paramsAll )== " col" ), " fill" )
102+ paramsAll $ lty <- NA # lty/lwd should always be NA for polygon & rectangles in the legend
103+ paramsAll $ lwd <- NA
106104 fun.specific <- list (border = par(" fg" ))
107105 }
108106
107+ usr.args <- paramsAll [which(names(paramsAll ) %in% names(fun.default ))]
109108 fun.all <- replace(fun.default , match(names(fun.specific ), names(fun.default )), fun.specific )
110109 add.args <- fun.all [! names(fun.all ) %in% names(usr.args )]
111110 fun.legend.args <- append(usr.args , add.args )
0 commit comments