ggvis

ggvis - Interactive X axis for bar chart

旧时模样 提交于 2019-12-18 04:59:10
问题 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(

Add data to ggvis tooltip that's contained in the input dataset but not directly in the vis

本小妞迷上赌 提交于 2019-12-17 10:44:13
问题 This is my input dataset: > names(breakingbad.episodes) [1] "season" "episode" "epnum" "epid" "title" [6] "url.trakt" "firstaired.utc" "id.tvdb" "rating" "votes" [11] "loved" "hated" "overview" "firstaired.posix" "year" [16] "zrating.season" "src" For my ggvis , I'm using the following variables firstaired.posix and rating : > str(breakingbad.episodes[c("firstaired.posix", "rating")]) 'data.frame': 62 obs. of 2 variables: $ firstaired.posix: POSIXct, format: "2008-01-21 02:00:00" "2008-01-28

boxplot won't display with ggvis

孤街醉人 提交于 2019-12-14 01:42:31
问题 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: Can't find prop y.update forcing a y variable: data.frame(theVar = c(1,5:10,15)) %>% ggvis(x = ~theVar,y=~theVar) %>% layer_boxplots() seems to turn it into

How to change legend position of ggvis when using tooltip as well?

折月煮酒 提交于 2019-12-13 17:16:56
问题 This thread shows how to change the position of the legend in a ggvis object. However, if tooltips are added as well, the legend disappears. library(ggvis) data(mtcars) mtcars %>% ggvis(x = ~wt, y = ~mpg, fill = ~cyl) %>% layer_points() %>% add_legend( "fill", properties = legend_props( legend = list( x = scaled_value("x", 3.25), y = scaled_value("y", 40) ) ) ) %>% add_tooltip(function(df) df$wt) Any idea how to prevent this? 回答1: This is a know issue, you can try adding the below at the end

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

纵饮孤独 提交于 2019-12-13 17:11:11
问题 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) %>% layer_paths() %>% layer_paths(x = ~timestamp, y = ~temperature, stroke := "red") %>% mutate(new_signal = signal - mySlider * temperature

Special symbols in ggvis

会有一股神秘感。 提交于 2019-12-13 15:23:29
问题 I'm making a fairly typical plot of geochemistry profiles for which I need to use a subscript and a greek symbol in the x-axis It should read CH4 (umol) where the 4 is subscript and the u is the greek symbol mu ggvis code: ch4 %>% ggvis(~ch4_umol, ~depth_cm, fill=~Core, stroke=~Core) %>% layer_lines(fillOpacity=0) %>% scale_numeric('y', reverse=T) %>% add_axis("y", title = "Depth (cm)") %>% add_axis('x', orient='top', title="CH[4] ("mu "mol)") Side-note: I know that I can make the proper

navbar Page and wrong update of ggvis plot Shiny

一笑奈何 提交于 2019-12-13 07:28:42
问题 Hi I 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 Plot navbarPage , plot does not work well. What happended? How to fix it? ui.R library(dplyr) library(shiny) library(ggvis) shinyUI( navbarPage("", tabPanel("Introduction", fluidRow( column(3, wellPanel( ) ), column(9,

Using Shiny to dispay conditional ggvis OR ggplot

有些话、适合烂在心里 提交于 2019-12-13 06:02:15
问题 Hi im using shiny to display some plots. I need to use both ggplot and ggvis as both have some funtionality the other doesnt have. My problem is I want to display a ggplot when my slider value is less than 100 and the ggvis when it is equal to 100. I can show both plots at once but cant find a way to be conditional on which plot needs to be displayed. Code below any help appreciated. shinyServer(function(input, output, session) { vis <- reactive({ input$goButton isolate({ output$myPlot <-

Problems using ggvis in rMarkdown with variables

北城余情 提交于 2019-12-13 01:50:27
问题 Hi having a couple of problems a) creating the correct text to pass variables to ggvis - not even sure aes_string is applicable b) The plot propagates in browser rather than rendering in the rmarkdown document Here is an example --- title: "Untitled" author: "pssguy" date: "Sunday, August 24, 2014" output: html_document runtime: shiny --- ```{r, echo = FALSE, message=FALSE} library(ggplot2) library(ggvis) library(dplyr) selectInput("category3", "Choose Dataset:", c("mpg", "disp", "qsec")) #

Draw a line with intercept and slope in ggvis

本小妞迷上赌 提交于 2019-12-12 11:55:25
问题 Just getting start with Shiny. I ask you: is it possible to add single lines characterized by intercept and slope to ggvis plot? For example with ggplot2 using geom_abline. The code that i'm interested to debat is in the server.R file located at https://github.com/wch/movies and refers to this example http://shiny.rstudio.com/gallery/movie-explorer.html. This is a way to draw a line x_min <- 0 x_max <- 10 m <- 1 b <- 5 x <- c(x_min, x_max) y <- m*x + b df <- data.frame(x = x, y = y) df %>%