htmlwidgets

Shiny actionButton() output in onRender() function of htmlWidgets

纵然是瞬间 提交于 2019-12-25 16:53:16
问题 My goal is to create a script where initially a blank plotly graph is displayed. If the user clicks on a Shiny actionButton saying "Add points", then points will be added to the plotly graph via the onRender() function of htmlWidgets. This would be efficient because the background blank plotly graph would not need to be replotted when the user selects the Shiny actionButton. However, in order for me to achieve this, I would need to figure out a way to indicate the change in the Shiny

Add permanent shaded rectangle with select Box corners in Plotly R

守給你的承諾、 提交于 2019-12-24 08:48:00
问题 This is a continuation of a previous post (Add shaded rectangle with select Box corners in Plotly R). I am creating an application where if a user employs the Box Select tool in Plotly, then a filled rectangle will appear alongside the Box Select. This is currently working, as is shown in the MWE below: library(ggplot2) library(shiny) library(plotly) library(htmlwidgets) ui <- basicPage( plotlyOutput("plot1") ) server <- function(input, output) { p <- ggplot(mtcars, aes(x = wt, y = mpg)) +

Network Analysis - Manipulating data - Shiny

不问归期 提交于 2019-12-24 07:11:33
问题 I'm using the networkD3 package and I'm trying to do some network analysis Let's say I have this data: src <- c("Dizzy Gillespie","Louis Armstrong","Max Roach","Charlie Parker","Charlie Parker") target <- c("Chet Baker","Chet Baker","Peter Erskine","John Coltrane","Wayne Shorter") group <- c("Trumpet","Trumpet","Drums","Saxophone","Saxophone") networkData <- data.frame(src, target,group) I've read this documentation https://christophergandrud.github.io/networkD3/ but they won't tell how they

htmlwidgets side by side in html?

瘦欲@ 提交于 2019-12-24 01:00:00
问题 Say I have two htmlwidgets # Load energy projection data # Load energy projection data library(networkD3) URL <- paste0( "https://cdn.rawgit.com/christophergandrud/networkD3/", "master/JSONdata/energy.json") Energy <- jsonlite::fromJSON(URL) # Plot sankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = "source", Target = "target", Value = "value", NodeID = "name", units = "TWh", fontSize = 12, nodeWidth = 30) and library(leaflet) data(quakes) # Show first 20 rows from the `quakes`

Retrieving R object attributes in JavaScript

落花浮王杯 提交于 2019-12-23 11:50:33
问题 I have a bivariate dataset with 100 observations. I used hexagon binning and ended up with 26 hexagon bins. In order to save the rows of the 100 observations that are in each of the 26 hexagon bins, I used the base::attr function in R. In the code below, this is done at: attr(hexdf, "cID") <- h@cID I am trying to create an interactive R Plotly object of the hexagon binning so that if a user were to click on a given hexagon bin, they would obtain the rows of the 100 observations that were

Put line break in node labels in networkD3 sankey diagram

瘦欲@ 提交于 2019-12-21 07:47:08
问题 ++++++++++++++++ Update: I think the answer to my question is that you can't put line breaks in. A colleague pointed out to me the node labels are SVG blocks, which don't support line breaks. ++++++++++++++++ How do I put a line break into the node labels for a sankey diagram produced using the networkD3 R package? Borrowing the example from Place text values to right of sankey diagram I can add values to the lables: library(networkD3) library(data.table) set.seed(1999) links <- data.table(

Display Edge Label only when Hovering Over it with Cursor - VisNetwork Igraph

淺唱寂寞╮ 提交于 2019-12-20 07:26:22
问题 Referring back to one of my previous post which contains the full reproducible code: VisNetwork from IGraph - Can't Implement Cluster Colors to Vertices My goal here is to change some of the visualization options from the visNetwork package graph. There are too many labels currently when I zoom in and it is very tough to distinguish which node belongs to which label. Is it possible to remove the labels from the visNetwork graph, and only display the labels when I hover over a node? I have

Changing line thickness and opacity in scatterplot on onRender() htmlWidgets in R

我的梦境 提交于 2019-12-20 06:32:31
问题 I am hoping to make a plot using the R package htmlwidgets' onRender() function in which a user can click on a point and a line is drawn. I have the crux of it working right now where a gray line is drawn at its default thickness and probably its default opaqueness. However, I have been stuck on changing the thickness of the line (and possibly changing the opaqueness of the line, although it may be working and I cannot see it since the line is so thin). I want the line to be very thick and

VisNetwork from IGraph - Can't Implement Cluster Colors to Vertices

醉酒当歌 提交于 2019-12-20 04:18:53
问题 I am starting to use the package called visNetwork and I feel like it has a ton of potential for User-Interface use in the future. There are few things that I am having trouble with though. I have created an igraph and have also applied a clustering algorithm to that specifically the fastgreedy algorithm. Example Code Provided: B = matrix( c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 3, 0, 3, 0, 1, 10, 13, 5, 0, 3, 19, 0, 1, 0, 1, 7, 3, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 1, 0, 32, 0, 0, 3, 2, 1

using leaflet-side-by-side plugin in R

五迷三道 提交于 2019-12-19 10:47:14
问题 I tried to implement leaflet-side-by-side plugin using example codes from Using arbitrary Leaflet JS plugins with Leaflet for R. Appears simple, no success so far. I could not figured out what I'm doing wrong. Greatly, appreciate your reply. Thanks, library(leaflet) library(htmltools) library(htmlwidgets) LeafletSideBySidePlugin <- htmlDependency("leaflet-side-by-side","2.0.0", src = c(href="https://github.com/digidem/leaflet-side-by-side"), script="leaflet-side-by-side.js") # A function that