FAQ Database Discussion Community


R ggvis interactive slider for calculating y values (e.g. for background correction)

r,dplyr,ggvis
I would like to use a ggvis slider to visually do a background correction of my data: library("dplyr") library("ggvis") library("lubridate") data <- data.frame(timestamp = Sys.time() - hours(10:1), signal = rnorm(10), temperature = rnorm(10)) mySlider <- input_slider(0, 2, value = 1, step = 0.1, label = "T-correction") data %>% ggvis(~timestamp, ~signal)...

ggvis plot disappears at random Shiny

r,shiny,ggvis
I have a strange problem in Shiny. My shiny app has one ggvis plot with layer_points() and several options to manipulate the plot . When I run my app sometimes everything works good even if I change all options, but sometimes ( I suppose there is no specific rule) plot...

Create dynamic ggvis chart from uploaded file in shiny

r,shiny,rcharts,ggvis
I am trying to use Shiny and ggvis to: 1) upload a data set 2) have the user select 2 columns (x, y) 3) return a ggvis plot displaying (x, y) from the uploaded data set I've tried editing the examples from the Shiny Interactivity page as well as the...

boxplot won't display with ggvis

r,plot,ggvis
I'm trying to make a boxplot with ggvis and I can't seem to view one even with a simple example library(dplyr) library(ggplot2) library(shiny) #I think this is required? not sure data.frame(theVar = c(1,5:10,15)) %>% ggvis(x = ~theVar) #makes a histogram data.frame(theVar = c(1,5:10,15)) %>% ggvis(x = ~theVar) %>% layer_boxplots() Error:...

R shiny ggvis tooltip will not update information with new data, even though plot updates

r,tooltip,shiny,ggvis
So I have a ggvis plot within a shiny application, which is a histogram that that displays the count of observations in a bin when the user hovers over the bin. The data is randomly generated and the user can hit a button to sample a new batch of data....

ggvis input_select on scale_numeric trans parameter

coordinates,transform,ggvis
I'm really newbie to ggvis and I searched all over web without success. I have a dataset like this one: data.example=data.frame("V1"=c(rep("A",times=10),rep("B",times=10)),"V2"=c(runif(10,1,10000),runif(10,100,1000))) head(data.example) V1 V2 1 A 7261.076 2 A 1955.755 3 A 3473.473 4 A 7593.278 5 A 3218.867 6 A 4997.951 tail(data.example) V1 V2 15 B 721.2147 16...

linked_brush in ggvis cannot work in Shiny when data change

r,shiny,ggvis
I want to create a Shiny APP which uses ggvis to plot a interactive figure and linked_brush to select points in the figure. The plot data are changed according to inputs. But I get an error message when I try to put all thing together. Error : Length of calculated...

Shiny & ggvis select subset of data dynamically

r,shiny,ggvis
how can I select a subset of the data and plot it using shiny & ggvis? As the ggvis documentation states, it is not possible to swap the dataset using ggvis input_select. Besides this limitation it would be awesome if the data preprocessing & filtering would have to be performed...

using add_tooltip in ggvis to print name when mouse hovers

r,ggvis
My data looks something like this: df = data.frame(name=c("A1", "A2"), x = c(2,4), y = c(2,5), sector = c("blue", "red")) I am trying to use ggvis to create a graph but I am not able to make the tooltip work. library(ggvis) df %>% ggvis(~x, ~y, size := 100, opacity :=...

ggvis plot disappears with tooltip and checkBoxInput Shiny

r,shiny,ggvis
I have a problem with using tooltip in ggvis in my Shiny app. I would like to use additional info about dot point in ggvis, that's why I create function which need id variable: add_info <- function(x) { if(is.null(x)) return(NULL) if (is.null(x$id)) return(NULL) df2<- isolate(data) df <- df2[df2$id == x$id,...

ggvis - add_legend with multiple data and position legend inside graph

r,ggvis
I'm trying to add legends with arbitrary text in a ggvis plot using data from different dataframes. I have tried using add_legend() but I have not idea about what parameters to use. Using plot() is very simple using the legend() function but it has been very hard to find a...

How to set ggvis to use canvas renderer by default?

r,shiny,ggvis,shinyapps
Is it possible to make a ggvis widget use the canvas renderer by default (instead of svg)?

Bar Plot x-axis order in R ggvis

r,bar-chart,ggvis
I am experimenting to use ggvis for my daily report. One issue I came across is that for a dataset that I intended to plot x-axis as in the data order. However, the actual plot shows up in the alphabet order. Is there any hidden parameters to change x-axis order...

add a legend with multiple lines in GGVIS

r,ggvis
I want to display multiple lines with ggvis. Data df <- read.table(header = TRUE, text = " subfunctionname activityname label activityunits activityhours ftehours avFteHours wlFteHours North IncidentPriority0 01-Jan 3950 3 36244 18122 11850 North IncidentPriority0 02-Feb 0 3 32800 16400 0 North IncidentPriority0 03-Mar 0 3 36408 18204 0 North...

Error in eval(substitute(expr), envir, enclos) in Shiny R

r,shiny,shiny-server,ggvis
I'm receiving the following error when trying to run a Shiny App I'm building. The error is: Listening on http://........ Error in eval(substitute(expr), envir, enclos) : incorrect length (0), expecting: 202 I've been modeling the base of my app after the movie-explorer example App. The data is fed in via...

How can I interpret dates returned from ggvis handle_click

r,date,ggvis
First experience of using handle_click library(ggvis) library(dplyr) # create data.frame counts <- c(1,2) dates <- as.Date(c("2015-01-01","2015-01-02")) df <- data.frame(count=counts,date=dates) # function to view clicked data getDate = function(data,location,session){ if(is.null(data)) return(NULL) glimpse(data) } df %>% ggvis(~date,~count) %>% layer_points() %>% handle_click(getDate) This returns when clicking the first point Observations: 1 Variables: $...

Adjusting x limits xlim() in ggplot2 geom_density() to mimic ggvis layer_densities() behavior

r,ggplot2,ggvis
Is there a way to make ggplot2's geom_density() function mimic the behavior of ggvis's layer_densities()? That is, make it so p1 looks like p3 (see below) without the call to xlim()? Specifically, I prefer the view that smooths the tails of the density curve. library(ggvis) library(ggplot2) faithful %>% ggvis(~waiting) %>%...

R: ggvis - HTML function - failing to “add_tooltip()”

r,ggvis
this is a basic question about ggvis. I've googled, but still... I want that, when someone hovers over a specific date (2014-12-05), the tooltip will show: 3,188 sessions (please, notice the comma).On so on for everyday on the data frame. Have this df: structure(list(date = structure(1:31, .Label = c("2014-12-01", "2014-12-02",...

R: ggvis - plot x label in intervals

r,ggvis
i've this data: structure(list(date = structure(1:31, .Label = c("2014-12-01", "2014-12-02", "2014-12-03", "2014-12-04", "2014-12-05", "2014-12-06", "2014-12-07", "2014-12-08", "2014-12-09", "2014-12-10", "2014-12-11", "2014-12-12", "2014-12-13", "2014-12-14", "2014-12-15", "2014-12-16", "2014-12-17", "2014-12-18", "2014-12-19", "2014-12-20", "2014-12-21", "2014-12-22", "2014-12-23", "2014-12-24", "2014-12-25", "2014-12-26", "2014-12-27", "2014-12-28", "2014-12-29", "2014-12-30", "2014-12-31" ), class = "factor"), sessions = c(1932L, 1828L,...

Add Interactive Chart to Shiny with HTML UI (index.html)

r,shiny,nvd3.js,rcharts,ggvis
I can see how ggvis, rCharts, etc. fits in with a server.r + ui.r construction. I'm now trying to make an HTML UI but am and unable to find any clues about passing an interactive chart to an HTML UI. Any clues? Investigated for ggvis, rCharts, NBD3. Not investigated for...

Use handle_click in ggvis to create an interactive filter in Shiny

r,shiny,ggvis
I have a basic Shiny app that uses a ggvis() graphic. The app is given below. I see in the documentation for ggvis() there is a handle_click(vis, on_click = NULL) function which can be passed. Further, the on_click is a callback function with arguments data, location and session. What I...

Adding unicode text to ggvis plot

r,unicode,ggvis
I am trying to add unicode text to a graphic using layer_text(), but it does not work unless I supply the text as a constant: x = data.frame(a=c(1,2),b=c("\\u2799","\\u2794")) # This one works x %>% ggvis(~a) %>% layer_text(text := "\\u2794") # Now does not work x %>% ggvis(~a) %>% layer_text(text :=...

ggvis side-by-side barchart grouped by second variable

r,bar-chart,ggvis
I am in process of migrating from Excel to ggvis for data analysis. For a typical grouped bar chart with two variables, however I have difficulty to plot bar chart side-by-side instead of stacked. The following data has four steps A, B, C, D with "ratio" data from two features...

shiny + ggvis: reactive using ggvis “tilde” or “~”

r,shiny,ggvis
All I want is an efficient way to set the ggvis fill property in server.R according to the InputSelect box in ui.R. Since the fill property syntax needs a "tilde" or "~" I was unable to come with a solution. The ui.R and server.R below are just one of my...

R Hexadecimal colours do not work in ggvis

r,ggvis
I have been fiddling around with ggvis and ran into this problem that I cannot use hexadecimal values for colours like regular R plots. Is this normal behaviour for ggvis or am I missing something? library(ggvis) # create data frame df <- data.frame(var1=1:10,var2=5:14,var3=factor(c(rep("A",5),rep("B",5)))) # code without custom colours df %>%...

navbar Page and wrong update of ggvis plot Shiny

r,shiny,ggvis
HiI just create Shiny app. But there is a little problem when I want to present my Shiny app in navbarPage way. I mean, when I add new navbarPage named Introduction everithing works fine with plot till... I come back to Introduction navbarPage and then one again come back to...

ggvis slider is squashed

r,ggvis
I am using R version 3.2.0 (2015-04-16) from RStudio Version 0.98.1103. The platform is platform i386-w64-mingw32. I am using Windows Vista Version 6. This code require(ggvis) require(dplyr) # ggvis use of a slider mtcars %>% ggvis(~wt, ~mpg, size := input_slider(10, 100), opacity := input_slider(0,1) ) %>% layer_points() works, but the...

R: Ggvis - add_tooltip for bar chart

r,ggvis
i'm having troubles using the add_tooltip from ggvis. I just want to put a tool tip for the sessions by source to my plot. I'm having troubles understanding the html function that needs to be created for add_tooltip() I understand i need an "ID" within my data (you can see...

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

function,shiny,ggvis
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...

ggvis integration with Shiny

r,shiny,ggvis
This is rather a simple question. I read other threads, and found that, in order to insert a GGVIS visualization into Shiny, you need: In ui.R - Call ggvisOutput("EvolucionVisitas") In server.R - use function bind_shiny("EvolucionVisitas") I'm having problems plotting the graph for my tab "Evolución Visitas". I did both, but...

legends on ggvis graph are overlaping when using tooltip

r,ggvis
I'm generating a graph with ggvis and the legends are in top of each-other. library(ggvis) df1 <- data.frame(x=c(0.6,1,1.4), y=c(-2, -.8, -0.2), number=c(10,8,6), type=c('A', 'A', 'B')) df1 %>% ggvis(x = ~x, y = ~y) %>% layer_points(shape=~type, fill=~number) How can I fix this? Thanks! Steven's solution works for the simple example but...

Interactivity within the same graph - ggvis

r,graph,shiny,data-visualization,ggvis
I have the following ggvis with shiny code, which produces 2 graphs with the mtcars data set that comes with R. In the first graph if I double click on a point, all the points with the same number of gear (mtcars$gear) within the 2nd graph turns into red. Motor...

Heatmap merging common rows for a consolidated plot in R

r,ggvis
I am using ggvis to create the heat map (plot1) using the following sample data. Class Super_class cell1 cell2 cell3 A1 A 2 3.96 0.6 A2 A 1 2.92 0 A3 A 5 0.56 6.4 A4 A 1 10.92 22.36 A5 A 0 0 5.32 B B 0 0 1...