Skip to content

Commit 5b077d7

Browse files
committed
we don't want a legend for x-values
1 parent df38352 commit 5b077d7

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

R/ggplotly.R

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ markLegends <-
105105
## group, even when they have the exact same visual
106106
## characteristics and could be drawn using just 1 trace!
107107
polygon=c("colour", "fill", "linetype", "size"),
108-
bar = c("colour", "fill"),
109-
density = c("colour", "fill", "linetype"),
108+
bar=c("colour", "fill"),
109+
density=c("colour", "fill", "linetype"),
110+
boxplot=c("colour", "fill", "size"),
110111
errorbar=c("colour", "linetype"),
111112
errorbarh=c("colour", "linetype"),
112113
area=c("colour", "fill"),
@@ -115,7 +116,8 @@ markLegends <-
115116

116117
markUnique <- as.character(unique(unlist(markLegends)))
117118

118-
markSplit <- c(markLegends,list(boxplot=c("x")))
119+
markSplit <- markLegends
120+
markSplit$boxplot <- c(markSplit$boxplot, "x")
119121

120122
guide_names <- function(p, aes = c("shape", "fill", "alpha", "area",
121123
"color", "colour", "size", "linetype")) {
@@ -306,9 +308,6 @@ gg2list <- function(p) {
306308
traces <- layer2traces(L, df, misc)
307309

308310
possible.legends <- markLegends[[L$geom$objname]]
309-
if (L$geom$objname == "boxplot"){
310-
possible.legends <- markSplit[[L$geom$objname]]
311-
}
312311
actual.legends <- possible.legends[possible.legends %in% names(L$mapping)]
313312
layer.legends[[paste(i)]] <- actual.legends
314313

R/trace_generation.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ layer2traces <- function(l, d, misc) {
294294
s <- no.sort[[tr.i]]$sort
295295
no.sort[[tr.i]]$showlegend <-
296296
if (is.numeric(s)) {
297-
if (s == Inf){
297+
if (all(s %in% Inf)){
298298
FALSE
299299
} else {
300300
TRUE

0 commit comments

Comments
 (0)