ggvis

ggvis is not rendering anything in the viewer pane in RStudio

耗尽温柔 提交于 2021-02-17 05:22:10
问题 I am not able to get any points when I plot my ggvis . Please see my code below: #install.packages("ggvis", dependencies = T) #install.packages("shiny", dependencies = T) #install.packages("htmltools", dependencies = T) #install.packages("tidyverse", dependencies = T) library(htmltools) library(shiny) library(tidyverse) library(ggvis) mtcars %>% ggvis(~wt, ~mpg) %>% layer_points() #then i get the blank image like below: I am on Windows 10, Rstudio is all up-to-date. I would greatly appreciate

Creating a scatter plot using ggvis in a shiny app

最后都变了- 提交于 2021-02-10 20:11:45
问题 I am trying to create a simple app that does the following: Import a csv file as a reactive (this has to be a reactive) Print the contents of csv as data table in one tabPanel Create an interactive scatter plot using ggvis in another tabPanel However I am unable to create the plot- the tabPanel where plot is supposed to appear is blank. There is no error or warning messages in the console whatsoever. Not sure what is wrong with the code. Here is the code: # Define UI for application ui <-

R Session Aborted when loading package

◇◆丶佛笑我妖孽 提交于 2021-01-28 19:56:51
问题 My RStudio (0.99.879, R 3.2.3, OSX 10.11.3) crashes with the R Session Aborted error box every time I run require(ggvis) (v0.4.2). I've reinstalled R, RStudio and ggvis - no change. Any idea what's causing this, or how to traceback? Running Sys.getenv() gives me this report, if it helps. 回答1: Sometimes startup errors like this can be caused by out-of-date dependent packages. You can try updating the packages that ggvis depends on with: db <- available.packages() deps <- tools::package

Plotting a step function in ggvis

我的梦境 提交于 2020-01-17 04:16:27
问题 I would like to plot a step function in ggvis which factors into two colours by a factor variable. In ggplot this can be achieved for this reproducible example by doing: library(ggplot2) set.seed(10) df=data.frame(id=1:100,y=rnorm(100),col=factor(c("MEN","WOMEN"))) ggplot(data=df)+geom_step(aes(id,y,colour=col)) In ggvis I have tried something like this: library(ggvis) set.seed(10) df=data.frame(id=1:100,y=rnorm(100),col=factor(c("MEN","WOMEN"))) df %>% ggvis(x = ~id, y = ~y,stroke := ~col) %

ggvis density plot with tooltip?

本秂侑毒 提交于 2020-01-15 02:48:07
问题 I'm trying to add a tooltip to my ggvis plot. I basically want to add the density number when I hover the mouse over the density plot. This is what I have right now: mtcars %>% ggvis(~wt, fill := "red") %>% layer_densities() %>% add_axis("x", title = "Weight") %>% scale_numeric("x", domain = c(0, 5), nice = FALSE, clamp = TRUE) %>% add_tooltip(function(df){density(df$wt)}) But when I hover, I get this error: Error in density.default(df$wt) : argument 'x' must be numeric Thanks! 回答1: I only

ggvis density plot with tooltip?

荒凉一梦 提交于 2020-01-15 02:47:19
问题 I'm trying to add a tooltip to my ggvis plot. I basically want to add the density number when I hover the mouse over the density plot. This is what I have right now: mtcars %>% ggvis(~wt, fill := "red") %>% layer_densities() %>% add_axis("x", title = "Weight") %>% scale_numeric("x", domain = c(0, 5), nice = FALSE, clamp = TRUE) %>% add_tooltip(function(df){density(df$wt)}) But when I hover, I get this error: Error in density.default(df$wt) : argument 'x' must be numeric Thanks! 回答1: I only

How do I label plot tick marks using ggvis

帅比萌擦擦* 提交于 2020-01-14 10:39:10
问题 I am trying to change the tick labels in a ggvis plot. My data points are x = c(1,2,3) and y = c(1,2,3) . However, the following code results in tick labels which make no sense at all! library(dplyr) library(ggvis) data.frame(x = c(1,2,3), y = c(1,2,3) ) %>% ggvis(~x,~y ) %>% layer_lines() %>% add_axis("x", properties=axis_props( labels=list(angle=90, fontSize = 10, text = c("one","two","three" ) ) ) ) gives: I imagine that I have to format the ticks as well, or at least tell ggvis which

How do I reference a clicked point on a ggvis plot in Shiny

帅比萌擦擦* 提交于 2020-01-13 06:53:10
问题 I wish to use the values of a clicked point for further processing but am unclear how to reference the data library(shiny) library(ggvis) library(dplyr) df <- data.frame(a=c(1,2),b=c(5,3)) runApp(list( ui = bootstrapPage( ggvisOutput("plot") ), server = function(..., session) { # function to handle click getData = function(data,location,session){ if(is.null(data)) return(NULL) # This returns values to console print(glimpse(data)) # Observations: 1 # Variables: # $ a (int) 2 # $ b (int) 3 } #

Rstudio shiny ggvis tooltip on mouse hover

馋奶兔 提交于 2020-01-11 19:43:37
问题 In the example below, I have an interactive shiny ggvis plot, but I added a long column that is a long string and for some reason, my hover pop-up shows wt and mpg but does not show long . Also, if the list of elements in the legend is too long, they are hidden at the bottom right corner of the plot. Is there any way to stack these in several columns in the legend? Any ideas? # ui.R library(ggvis) shinyUI(pageWithSidebar( div(), sidebarPanel( sliderInput("n", "Number of points", min = 1, max

Rstudio shiny ggvis tooltip on mouse hover

萝らか妹 提交于 2020-01-11 19:43:20
问题 In the example below, I have an interactive shiny ggvis plot, but I added a long column that is a long string and for some reason, my hover pop-up shows wt and mpg but does not show long . Also, if the list of elements in the legend is too long, they are hidden at the bottom right corner of the plot. Is there any way to stack these in several columns in the legend? Any ideas? # ui.R library(ggvis) shinyUI(pageWithSidebar( div(), sidebarPanel( sliderInput("n", "Number of points", min = 1, max