htmlwidgets

Change size of hover text in Plotly

房东的猫 提交于 2019-12-04 04:32:48
I am building a Plotly plot based on a ggplot in R. I would like to increase the size of the text in the hover boxes. Suppose I have a scatterplot like this: library(plotly) library(ggplot2) d <- data.frame(a = sample(1:50, 30, T), b = sample(1:50, 30, T), col = factor(sample(1:3, 30, T))) gg <- ggplot() + geom_point(aes(x = a, y = b, color = col), data = d) p <– plotly_build(gg) p Is there a way to change the size of the hover text? Currently there seems to be no built-in way to pass additional attributes to define the hover appearance directly via plotly (see github issue #102 ). However, in

Going crazy with forceNetwork in R: no edges displayed

♀尐吖头ヾ 提交于 2019-12-04 04:17:21
问题 I've been trying to plot a network using networkD3 package in R for a week now. The simpleNetwork function works normally, but it doesn't allow much control over the appearance of the graph. The forceNetwork function is there for this purpose: display graph with enriched visual features. The problem I have is pretty much the same exposed in this question. I have carefully read the package documentation, and tried the solution proposed in the above thread, with no luck: all I get is a cloud of

Put line break in node labels in networkD3 sankey diagram

故事扮演 提交于 2019-12-04 02:34:34
++++++++++++++++ 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( src = rep(0:4, times=c(1,1,2,3,5)), target = sample(1:11, 12, TRUE), value = sample(100, 12) )[src <

Modify networkD3 sankey plot with user-defined colors

别等时光非礼了梦想. 提交于 2019-12-03 07:40:20
I have a sankey plot created in networkD3 package. I would like to modify the colors and transparency of both nodes and links. My data networkD3_data is appended at the end. Question 1: How to modify node colors with user-defined palette? I am not sure how to modify the colors with user-defined palette. It is necessary for me to use the same color palette specific to each node source to keep consistent with other plots I have. Currently I am able to have each source node be a different color and all target nodes to be same color by defining the NodeGroup . The plot below is close to what I

how to define nodes and links data frame for sankeyNetwork()

一世执手 提交于 2019-12-02 23:07:59
问题 I have a file with export from source country to target country, the value of the trade is in Before_value dimension. My data is in a data.table with dimensions source and target as character (list of country codes) and beofre_value numeric. I would like to generate a sankey diagram, using sankeyNetwork() from networkd3, with the source countries on the left and the target countries on the right and the flows represented. How do I define the nodes and links data frames properly? I have these

R Shiny: includeMarkdown cannot render htmlwidgets

余生颓废 提交于 2019-12-02 12:18:58
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 Answering my own question. The code in includeMarkdown is not be executed by knitr. 来源: https://stackoverflow.com/questions/39171890/r-shiny

forceNetwork is not zero indexed

混江龙づ霸主 提交于 2019-12-02 00:12:20
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$source,target=temp$target) g<-graph.data.frame(cbind(temp$source,temp$target), directed=T) nodes<-data

Going crazy with forceNetwork in R: no edges displayed

此生再无相见时 提交于 2019-12-01 21:21:56
I've been trying to plot a network using networkD3 package in R for a week now. The simpleNetwork function works normally, but it doesn't allow much control over the appearance of the graph. The forceNetwork function is there for this purpose: display graph with enriched visual features. The problem I have is pretty much the same exposed in this question. I have carefully read the package documentation, and tried the solution proposed in the above thread, with no luck: all I get is a cloud of nodes with no edges linking them. Here my data.frame s: edg Gene1 Gene2 Prob 1 22 3 2 22 6 3 22 6 4 22

R networkD3 color node stroke for radialNetwork()

二次信任 提交于 2019-12-01 10:59:37
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.tree) ## Data input <- list(number=50) Data_tree <- data.frame(Start="Class", Asset = sample(c("FI",

Dynamically loop through htmlwidgets and add knitr formatting for RMarkdown

删除回忆录丶 提交于 2019-11-30 18:11:04
问题 I am trying to dynamically create and loop through htmlwidgets such as DT , plotly , or rbokeh to generate an automated knitr report. Is there a way to add knitr formatting, such as the tabset , into the tagList approach outlined in this github question https://github.com/ramnathv/htmlwidgets/pull/110? I have also posted this question there. Below is some example code of what I am thinking, but it does not quite work. What I am trying to do is create 10 tabs, each with a copy of the plot