From f79618a5b3e3c490fefa49b548862a6be296a461 Mon Sep 17 00:00:00 2001 From: cpsievert Date: Fri, 11 Dec 2015 14:55:57 -0600 Subject: [PATCH] hex as a special case of point --- R/ggplotly.R | 1 + R/trace_generation.R | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/R/ggplotly.R b/R/ggplotly.R index fcad2e1bae..5fc9d61a5d 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -99,6 +99,7 @@ markLegends <- # Legends based on sizes not implemented yet in Plotly # list(point=c("colour", "fill", "shape", "size"), list(point=c("colour", "fill", "shape"), + hex=c("count", "density"), path=c("linetype", "size", "colour", "shape"), ## NOTE: typically "group" should not be present here, since ## that would mean creating a separate plotly legend for each diff --git a/R/trace_generation.R b/R/trace_generation.R index fae9fef4a1..10a031f9f2 100644 --- a/R/trace_generation.R +++ b/R/trace_generation.R @@ -367,6 +367,10 @@ toBasic <- list( g$data <- g$data[!is.na(g$data$y), ] g }, + hex=function(g) { + g$geom <- "point" + g + }, contour=function(g) { g$data <- g$prestats.data g @@ -545,6 +549,7 @@ geom2trace <- list( params$alpha))) }, point=function(data, params){ + #browser() L <- list(x=data$x, y=data$y, name=params$name, @@ -573,6 +578,8 @@ geom2trace <- list( if (!is.null(params$shape) && params$shape %in% c(32)) { L$visible <- FALSE } + # for geom/stat hex + if (params$stat.type == "binhex") L$marker$symbol <- "hexagon" L }, text=function(data, params){