ggvis

Interactive scatter plots in R, overlay/hover summary/tooltip as user supplied plot function

╄→尐↘猪︶ㄣ 提交于 2019-11-30 17:11:38
问题 I have been looking into interactive plots in R. I know that there are several packages to create interactive plots, especially scatterplots, but I am looking for a certain functionality. For example this plot. One can hover with the mouse over the buttons to get a small numerical summary of the data behind the point, i.e. a tooltip. When you have a data set with more variables, it is often nice to explore/visualize scores from PCA, or do multi-dimensional-scaling(MDS). But if one would plot

Switch plots based on radio buttons in R shiny conditionalPanel

浪子不回头ぞ 提交于 2019-11-30 16:24:57
I am trying to create a shiny app with ggvis plots and radio buttons. I have three plots created by ggvis. Users can switch the different plot based on which radio option they select. For example, if user selects A, only plot1 is displayed on user interface. If user select B, the plot switch to plot2. My problem is I don't know how to connect the plots with radio buttons. I've been struggling for hours. Thanks a lot for your help! I have some example code below. df <- data.frame(Student = c("a","a","a","a","a","b","b","b","b","b","c","c","c","c"), year = c(seq(2001,2005,1),seq(2003,2007,1),seq

Add a plot title to ggvis

微笑、不失礼 提交于 2019-11-29 23:32:12
I want to add a title to a ggvis plot. I can't find an example anywhere. It's simple to do with other R plots, e.g. library(ggplot2) library(ggvis) x <- 1:10 y <- x^2 df <- data.frame(x, y) plot(x, y, main = "Plot Title") # Base R with title ggplot(df, aes(x, y)) + geom_point() + ggtitle("Plot Title") # ggplot2 with title df %>% ggvis(~x, ~y) %>% layer_points() # ggvis but no title?? Feel like I'm missing something obvious. Any help appreciated. Well, seems like it has not been implemented (or documented?) yet. I'm pretty sure this will be added soon. For now, you can use a dirty hack like so:

Switch plots based on radio buttons in R shiny conditionalPanel

走远了吗. 提交于 2019-11-29 23:24:53
问题 I am trying to create a shiny app with ggvis plots and radio buttons. I have three plots created by ggvis. Users can switch the different plot based on which radio option they select. For example, if user selects A, only plot1 is displayed on user interface. If user select B, the plot switch to plot2. My problem is I don't know how to connect the plots with radio buttons. I've been struggling for hours. Thanks a lot for your help! I have some example code below. df <- data.frame(Student = c(

legends orientation in ggvis

和自甴很熟 提交于 2019-11-29 15:23:03
In ggvis how to make legend vertical? mtcars %>% ggvis(x = ~wt, y = ~mpg, fill = ~cyl) %>% layer_points() %>% add_legend("fill",properties = legend_props( legend = list(x = 500, y = 50))) It puts the legends horizontally. I want it to be vertical. Try the below code: mtcars %>% ggvis(~wt, ~mpg, size = ~cyl, fill = ~cyl) %>% layer_points() %>% add_legend(c("size", "fill")) Output chart: Hope this helps. Edit: I explored the add_legend properties and unfortunately I do not see any way of achieving vertical continues scale legend using ggvis for now, however it can be achieved using ggplot2 . R

Heat map with numbers in ggvis

∥☆過路亽.° 提交于 2019-11-29 14:07:46
问题 I'm trying to replicate the heat map with numbers from ggplot2 in ggvis. ggplot2 version is library(ggplot2) hec <- as.data.frame(xtabs(Freq ~ Hair + Eye, HairEyeColor)) ggplot(hec, aes(Hair, Eye)) + geom_tile(aes(fill = Freq)) + geom_text(aes(label = Freq),colour="white") and it looks like that My version in ggvis is hec%>% ggvis(~Hair, ~Eye, fill=~Freq)%>% layer_rects(width = band(), height = band()) %>% layer_text(text:=~Freq,fontSize := 20, fill:="white",baseline:="top",align:="center") %

Is it possible with ggvis to interactively change the variables for the x and y axes?

独自空忆成欢 提交于 2019-11-29 12:09:44
问题 Does anyone know if it is possible to change the variables for the x and y axis interactively with ggvis? I can change the size of the data points, their position and opacity, but I can't work out if its possible to allow the user to select a variable from a dropdown that will become the data for the x/y axis. 回答1: The ggvis package was designed to be used in conjunction with dplyr , e.g. to summarise data. The dplyr package also re-exports the magrittr pipe operator ( %>% , see README.md),

ggvis - Interactive X axis for bar chart

爷,独闯天下 提交于 2019-11-29 07:11:19
I'm looking into building a shiny app with ggvis. For this I'm using a small dataset called "company". It contains employee data where each line represents and employee. From a ggvis perspective I'm trying the following: Creating a bar chart that shows distribution for the following variables: Age Role Sex Instead of creating three different bar charts by using the following code: #Barcharts - Role company %>% ggvis(~Role,opacity := 0.8, fill:= "firebrick") %>% layer_bars() %>% scale_ordinal('x', domain=c('Analyst','Consultant','Software Engineer','Manager','Director')) #Barcharts - Age

Rstudio shiny not able to use ggvis

▼魔方 西西 提交于 2019-11-29 02:37:19
I have an RStudio Shiny server running and I installed ggvis from https://github.com/rstudio/ggvis but I am not able to reproduce any of the demo examples in the server. When I run R with the same version installed in the server (3.1.0), I can do the following: > library("shiny") > library("ggvis") The ggvis API is currently rapidly evolving. We strongly recommend that you do not rely on this for production, but feel free to explore. If you encounter a clear bug, please file a minimal reproducible example at https://github.com/rstudio/ggvis/issues. For questions and other discussion, please

Add a plot title to ggvis

邮差的信 提交于 2019-11-28 20:07:57
问题 I want to add a title to a ggvis plot. I can't find an example anywhere. It's simple to do with other R plots, e.g. library(ggplot2) library(ggvis) x <- 1:10 y <- x^2 df <- data.frame(x, y) plot(x, y, main = "Plot Title") # Base R with title ggplot(df, aes(x, y)) + geom_point() + ggtitle("Plot Title") # ggplot2 with title df %>% ggvis(~x, ~y) %>% layer_points() # ggvis but no title?? Feel like I'm missing something obvious. Any help appreciated. 回答1: Well, seems like it has not been