Resize with layer_arcs not working
Opened this issue · 1 comments
mheiser-md commented
Hi everyone,
thank you so far for everything you've done with this package, really appreciate it!
I've made an obervation, that's been bugging me for a while:
I can't get layer_arcs to find the right scale for inner and outer radius so it fits correctly to the plot area. If I set scale_numerical to the min/max of the data it seems to work somehow. However resizing the area does not change the size of the radius (but the x and y position).
This becomes a nuisance if the plots are viewed on different screens, where the initial size of the plot area (in pixels) can vary. Am I missing an option somewhere?
library(shiny)
library(ggvis)
library(dplyr)
shinyApp(
ui = fluidPage(
h3("Resize only changes canvas"),
ggvisOutput("round"),
h3("Resizable plot"),
ggvisOutput("bar")
),
server = function(input, output, session){
data.frame(
inner = rep(10, 6),
outer = runif(6, 15, 50),
end = seq(1, to = 2*pi, length.out = 6),
init = lag(seq(1, to = 2*pi, length.out = 6), 1, 0),
x = rep(0.5, 6),
y = rep(0.5, 6)
) %>%
ggvis( ~x, ~y) %>%
layer_arcs(
startAngle =~init, endAngle =~end,
outerRadius =~outer, innerRadius =~ inner,
fillOpacity := 1, fillOpacity.hover := 0.4
) %>%
scale_numeric("radius", domain = c(0, 15)) %>%
scale_numeric("x", domain = c(0,1)) %>%
scale_numeric("y", domain = c(0,1)) %>%
set_options(keep_aspect = TRUE) %>%
hide_axis("x") %>%
hide_axis("y") %>%
bind_shiny("round")
data.frame(
y = rt(120, 3)
) %>%
ggvis(~y) %>%
bind_shiny("bar")
}
)
> devtools::session_info()
Session info ---------------------------------------------------------------------------------------------------------------------------------
setting value
version R version 3.2.1 (2015-06-18)
system x86_64, mingw32
ui RStudio (0.99.473)
language (EN)
collate German_Germany.1252
tz Europe/Berlin
date 2016-04-05
Packages -------------------------------------------------------------------------------------------------------------------------------------
package * version date source
assertthat 0.1 2013-12-06 CRAN (R 3.2.2)
DBI 0.3.1 2014-09-24 CRAN (R 3.2.2)
devtools 1.9.1 2015-09-11 CRAN (R 3.2.2)
digest 0.6.8 2014-12-31 CRAN (R 3.2.2)
dplyr * 0.4.3 2015-09-01 CRAN (R 3.2.2)
ggvis * 0.4.2 2015-10-12 Github (rstudio/ggvis@81c0271)
htmltools 0.2.6 2014-09-08 CRAN (R 3.2.2)
httpuv 1.3.3 2015-08-04 CRAN (R 3.2.2)
jsonlite 0.9.19 2015-11-28 CRAN (R 3.2.2)
lazyeval 0.1.10.9000 2015-10-12 Github (hadley/lazyeval@ecb8dc0)
magrittr 1.5 2014-11-22 CRAN (R 3.2.2)
memoise 0.2.1 2014-04-22 CRAN (R 3.2.2)
mime 0.4 2015-09-03 CRAN (R 3.2.2)
R6 2.1.1 2015-08-19 CRAN (R 3.2.2)
Rcpp 0.12.2 2015-11-15 CRAN (R 3.2.2)
shiny * 0.12.2 2015-08-05 CRAN (R 3.2.2)
xtable 1.8-0 2015-11-02 CRAN (R 3.2.2)
AndrewSkelton commented
I'm seeing this issue too, and wondering if anyone has a solution?