htmlwidgets

How to capture html output as png in R

删除回忆录丶 提交于 2019-12-12 18:34:28
问题 I use interactive output created by networkD3 package in R. I know how to save the output as html page, but I also need to save the 'static' version of the diagram as .png file. The code looks like this: # Load package library(networkD3) # Create fake data src <- c("A", "A", "A", "A", "B", "B", "C", "C", "D") target <- c("B", "C", "D", "J", "E", "F", "G", "H", "I") networkData <- data.frame(src, target) # Plot simpleNetwork(networkData) I can save the output by clicking on 'Export' and then

Why are plotly-rendered graphs not working on Mozilla

馋奶兔 提交于 2019-12-12 09:58:26
问题 I am getting the following error when trying to open an html document put together with knitr in Mozilla Firefox. The error is a result of the graph element composed with the plotly package. unknownError: error occurred while processing 'getCachedMessages: out of memory The entire contents of the rmarkdown file (default everything else): library(plotly) library(ggplot2) theData <- data.frame(A=1:26, B=letters, C=rnorm(26,19)) g<-ggplot(theData, aes(x=A, y=C)) + geom_point() ggplotly(g) I have

Change size of hover text in Plotly

 ̄綄美尐妖づ 提交于 2019-12-12 08:45:26
问题 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? 回答1: Currently there seems to be no built-in way to pass

R Shiny HTMLWidget for interactive 3D-histograms

眉间皱痕 提交于 2019-12-11 17:21:11
问题 I would like to include a 3D dynamic (i.e. one can change its perspective just by moving the plot) histogram widget in a R Shiny application. Unfortunately I didn't find any until now. So far the results of my searches: with threejs (e.g. here on CRAN and there on GitHub) one can use many different representations (scatterplots, surfaces, etc.) but no 3D histogram. plot3D and plot3Drgl don't have any R Shiny counterpart. Unless something already exists my intention is to create an HTMLWidget

R Shiny renderImage() does not recognize object 'input' [duplicate]

主宰稳场 提交于 2019-12-11 12:13:41
问题 This question already has answers here : Save plots made in a shiny app (4 answers) Closed 3 years ago . Why does renderImage() not recognize input in the code sample below: library(d3heatmap) library(shiny) library(ggplot2) ui <- fluidPage( h1("A heatmap demo"), selectInput("palette", "Palette", c("YlOrRd", "RdYlBu", "Greens", "Blues")), checkboxInput("cluster", "Apply clustering"), downloadButton('downloadPlot', 'Download Heatmap'), d3heatmapOutput("heatmap") ) server <- function(input,

Add onclick open hyperlink event to an html widget created in R

 ̄綄美尐妖づ 提交于 2019-12-11 08:15:38
问题 I would like to be able to do something like the answer of this but without using shiny. I also want to bind onclick events which open a hyperlink associated with the data point. I am using the saveWidget function from htmlwidgets and know that I can insert javascript code with the appendContent function from the htmltools package. Here is a small sample code: library(ggplot2) library(plotly) library(htmlwidgets) library(htmltools) path.test.results <- "C:\\Users\\img\\" myData <- data.frame

Sankey Diagram with R library networkD3 does not show colors

帅比萌擦擦* 提交于 2019-12-11 07:14:17
问题 I am using the networkD3 library for R in order to create Sankey networks. While this works pretty well for me, I have now encountered an issue with assigning the attributes "NoteID" and/or "NoteGroup" to group and allocate colors as shown in https://christophergandrud.github.io/networkD3/#sankey The following code shows 4 examples of creating a Sankey diagram, only "Sankey4" works as designed, i.e., no colors: library(networkD3) #Unique list of nodes my_nodes = structure(list(name = c(

Adjust background picture and title for plot from networkD3's forceNetwork

故事扮演 提交于 2019-12-11 06:35:54
问题 Following the post here, Change the color of the legend text in forceNetwork for networkD3, I am trying to add a picture from a local drive as the background image, and also add a title to the graph. However, these lines do not seem to take effect: Background: .style("background-image", "url(C:\\Desktop\\BGP.png)") Title: htmlwidgets::prependContent(htmltools::tags$h1("Title")) What is the right way to add them in? Also, is there a way to adjust the font style and size of the title text as

Highlight all connected paths from start to end of a sankey diagram using networkD3

感情迁移 提交于 2019-12-11 05:31:34
问题 I would like to produce a Sankey-diagram using the networkD3 package in R that has the functionality as described in this question, and the "highlight_node_links" function in the answer: d3 Sankey - Highlight all connected paths from start to end I'm a beginner with both R and Javascript and my problem is that I cannot make the above javascript function work with my R code. I have checked Highlight all connected paths from start to end in Sankey graph using R question too, but unfortunately I

Add shaded rectangle with select Box corners in Plotly R

北慕城南 提交于 2019-12-11 04:28:44
问题 I am trying to create an application where if a user employs the Box Select tool in Plotly, then a filled rectangle will appear alongside the Box Select. To accomplish this, I am trying to call Plotly.addTrace() to create a rectangle object (type: rect) that has the corners of the box the user selected. I am able to obtain the coordinates of the corners of the box the user selected (in the code they are called xMin, xMax, yMin, and yMax). However, I then try to create a variable called