Closed
Description
When plotting a ggplot object "improved" with a second scale using https://github.com/eliocamp/ggnewscale a warning is printed and only the last geom is included in the plotly figure.
Herewith I'm following the advice from the Warning and opened this issue :-)
It would be great if someone may extend plotly in this direction.
Reprex:
library(ggplot2)
library(ggnewscale)
# Equivalent to melt(volcano)
topography <- expand.grid(x = 1:nrow(volcano),
y = 1:ncol(volcano))
topography$z <- c(volcano)
# point measurements of something at a few locations
set.seed(42)
measurements <- data.frame(x = runif(30, 1, 80),
y = runif(30, 1, 60),
thing = rnorm(30))
p <- ggplot(mapping = aes(x, y)) +
geom_contour(data = topography, aes(z = z, color = stat(level))) +
# Color scale for topography
scale_color_viridis_c(option = "D") +
# geoms below will use another color scale
new_scale_color() +
geom_point(data = measurements, size = 3, aes(color = thing)) +
# Color scale applied to geoms added after new_scale_color()
scale_color_viridis_c(option = "A")
# fine:
p
# warning & incomplete plot:
plotly::ggplotly(p)
Taken from: https://github.com/eliocamp/ggnewscale/blob/master/README.md
Warning:
This version of Shiny is designed to work with 'htmlwidgets' >= 1.5.
Please upgrade via install.packages('htmlwidgets').
Warning message:
In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_NewGeomContour() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues
Environment:
>R.version
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 5.3
year 2019
month 03
day 11
svn rev 76217
language R
version.string R version 3.5.3 (2019-03-11)
nickname Great Truth
> packageVersion("plotly")
[1] ‘4.9.0’
Metadata
Metadata
Assignees
Labels
No labels