htmlwidgets

Change the color of the legend text in forceNetwork for networkD3

老子叫甜甜 提交于 2020-01-14 03:04:14
问题 Using forceNetwork from the networkD3 R package, how can I change the color of the text in the legend to white? My Code: library(networkD3) forceNetwork(Links = subLinkList, Nodes = subNodes, Source = "root", Target = "children", Value = "linkValue", NodeID = "nodeName", Nodesize = "nodeSize", Group = "nodeGroup", colourScale = JS(colorScale), charge = -500, opacity = 1, opacityNoHover = 1, fontSize = 25, fontFamily = "Calibri", linkDistance = JS('function(){d3.select("body").style(

R Shiny: includeMarkdown cannot render htmlwidgets

妖精的绣舞 提交于 2020-01-11 13:11:49
问题 This rmd file render ok to html, but the output is empty in shiny. Same problem with other htmlwidets like chartJSRadar file.rmd: --- title: "test" output: html_document --- ```{r} rpivotTable::rpivotTable(data.frame(a = c(1:10) ) , rows = 'a' ) ``` the htmlwidget is missing in this shiny app ui <- shinyUI( fluidPage( includeMarkdown('file.rmd') ) ) server <- function(input, output) { } shinyApp(ui, server) This question is related to this one 回答1: Answering my own question. The code in

Retrieving R object attributes in JavaScript - Part 2

假如想象 提交于 2020-01-04 00:46:06
问题 I posted a similar question earlier (Retrieving R object attributes in JavaScript). In that earlier post, I oversimplified my MWE, and so the answer I rewarded unfortunately does not really apply to my real problem. Here, I am showing why I may need to retrieve R object attributes in JavaScript (unless there is another option that I am not aware of). I have a 5-variable dataset with 100 observations. I used hexagon binning and created a scatterplot matrix. Each of the 10 scatterplots has

Interaction between html widgets in R shiny

拜拜、爱过 提交于 2020-01-02 05:34:15
问题 I am developing an R shiny application that uses several html widgets, notably networkD3 , d3heatmap and chorddiag . These widgets work fine separately. However, using them in the same page leave a blank space where they are supposed to be. Here is a reproducible code that shows the bug. Comment plots line in the UI and you will see plots appearing and disappearing.. I thank you very much for your help! # libraries library(shiny) library(d3heatmap) library(chorddiag) library(networkD3) #

Interactively adding points to plotly R without redrawing background plot

烂漫一生 提交于 2020-01-01 19:22:05
问题 The MWE below oversimplifies my real goal. However, I have a background image that takes a long time to draw (in the example below it is simply a scatterplot of 32 mtcars dataset values). Users can click on certain points from my background image, and this will cause new points to be plotted. My aim is for these new points to simply be redrawn on the top layer, while the background image scatterplot does not need to be redrawn to save time and computation. My MWE is as follows: library(plotly

forceNetwork is not zero indexed

試著忘記壹切 提交于 2019-12-31 01:56:09
问题 I am trying to create a simple forceNetwork , but the plot won't render. I keep getting the following warning: Warning message: It looks like Source/Target is not zero-indexed. This is required in JavaScript and so your plot may not render. How do I fix this? Note that simpleNetwork works fine so the problem seems to be in how I am specifying my data. library(igraph) library(networkD3) set.seed(42) temp<-data.frame(source=c(1,2,3,4),target=c(2,3,4,4))#csv[1:500,] links<-data.frame(source=temp

R networkD3 color node stroke for radialNetwork()

旧时模样 提交于 2019-12-30 11:09:20
问题 The networkd3 package contains some very nice functions for creating the obvious networks. Different functions have different arguments, so this questions is specifically in regards to the radialNetwork() function. Is it possible to have the color of the node stroke change according to a given vector? The below code creates a the network graph but changing the argument for the node stroke to a vector containing different colors does not work. library(networkD3) library(tidyverse) library(data

linking a node in networkD3 to a website using clickAction = NULL

房东的猫 提交于 2019-12-30 05:27:17
问题 Is there a way to use a node as a link to an external website using the function forceNetwork() in the networkD3 package in r ? I was thinking maybe modifying the clickAction ? Example data: library(networkD3) data(MisLinks) data(MisNodes) # Create a random URL in the nodes dataset MisNodes$URL <- paste0("http://www.RANDOMLINK_", sample(1:100, NROW(MisNodes)), ".com") head(MisNodes) MyClickScript <- 'alert(d.index)' forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source", Target =

Tiny plot output from sankeyNetwork (NetworkD3) in Firefox

ぐ巨炮叔叔 提交于 2019-12-29 07:01:48
问题 As per object, I get a very small plot in Firefox when using sankeyNetwork() from networkd3 in shiny but not in Chrome or RStudio. I have not included any CSS or JS in the script - the code below produces this result for me. Is there any CSS property I have missed? I am using R 3.4.1, shiny 1.1.0, networkD3 0.4 and Firefox 52.9.0. Firefox: Chrome: library(shiny) library(magrittr) library(shinydashboard) library(networkD3) labels = as.character(1:9) ui <- tagList( dashboardPage(

Highlight all connected paths from start to end in Sankey graph using R

烈酒焚心 提交于 2019-12-28 05:54:21
问题 I want to highlight the whole path when i click on the node to know the whole story of specific node and here's an example- http://bl.ocks.org/git-ashish/8959771 . Please check this link and you will find the function that highlight the path in javscript, but take care please , this function doesn't do what i want, it highlight links related to the clicked node and the links related to the target nodes. what i want is to highlight all links related to the clicked node. d3 Sankey - Highlight