Skip to content

Commit 5303eeb

Browse files
committed
Got legend x,y working. It might be worth a re-factor...probably could be cleaner.
1 parent 107b581 commit 5303eeb

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

R/legend.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ legend <- function(object, ...){
7676

7777
legend.gsplot <- function(object, location="topright", legend_offset=0.3, ...) {
7878
arguments <- list(...)
79+
80+
if("x" %in% names(arguments)){
81+
location <- arguments$x
82+
}
83+
7984
gsConfig <- list(location = location, legend_offset = legend_offset)
8085

8186
arguments <- appendLegendPositionConfiguration(location, gsConfig, arguments)
@@ -97,6 +102,8 @@ appendLegendPositionConfiguration <- function(location, gsConfig, arguments) {
97102
return(append(arguments, list(x = "right", y = NULL, inset=c(-legend_offset, 0), bty="n")))
98103
} else if(location == "toleft") {
99104
return(append(arguments, list(x = "left", y = NULL, inset=c(-legend_offset, 0), bty="n")))
105+
} else if("x" %in% names(arguments)){
106+
return(arguments)
100107
} else {
101108
return(append(arguments, list(x = location)))
102109
}

0 commit comments

Comments
 (0)