plotly

R shiny and plotly getting legend click events

心已入冬 提交于 2019-12-01 08:16:09
问题 I have an R shiny page, and am filtering the data based on clicking a pie graph. It would be great if I could trigger the same filtering event from clicking legend entries, but I can't seem to find the event trigger, so it just filters that chart without propagating to the other charts. Is a legend click event accessible? library(data.table) library(plotly) library(shiny) dt = as.data.table(mtcars) ui <- fluidPage( plotlyOutput("pie1"), plotlyOutput("pie2") ) server <- function(input, output)

Can't generate plotly interactive plots in Rmarkdown report

早过忘川 提交于 2019-12-01 08:12:55
问题 I have an Rmarkdown document with a plot made with plotly and would like to generate an html file. It works when I click on Knit to HTML in Rstudio, but not when I run the following on the command line: Rscript -e "require(knitr)" -e "require(markdown)" -e "knit('Untitled.Rmd', out='report.md')" -e "markdownToHTML('report.md', 'report.html')" After this, I have a report.html file which contains the plot generated with plotly, but it is not interactive. Does anyone know how to make it

Creating a reactive dataframe with shiny apps

守給你的承諾、 提交于 2019-12-01 08:12:29
I am trying to get this reactive to return a data frame that I can manipulate with plotly. avghour <- reactive({ result <- data.frame() start_date <- as.numeric(unlist(input$i6[1])) end_date <- as.numeric(unlist(input$i6[2])) mkw <- maxkwpeakdates[(maxkwpeakdates >= start_date & maxkwpeakdates <= end_date) & !is.na(maxkwpeakdates), ] mkw <- na.omit(mkw) mopkw <- maxonpeakkwdates[(maxonpeakkwdates >= x & maxonpeakkwdates <= y) & !is.na(maxonpeakkwdates), ] mopkw <- na.omit(mopkw) mkwhour <- data.frame(as.data.frame(apply(mkw, 2, hour))) mopkwhour <- as.data.frame(apply(mopkw, 2, hour)) mkwhour

r plotly 3d surface plot issue

妖精的绣舞 提交于 2019-12-01 06:48:13
I am trying to plot a 3d surface plot based on these plotly examples When I try these examples on my dataset test_plotly = structure(list(Age = c(82L, 82L, 83L, 83L, 83L, 81L, 81L, 81L, 79L, 80L, 82L, 78L, 78L, 79L, 78L, 80L, 79L, 77L, 77L, 77L, 77L, 78L, 76L, 77L, 77L, 78L, 77L, 76L, 83L, 79L, 76L, 84L, 75L, 75L, 77L, 74L, 74L, 75L, 74L, 74L, 73L, 73L, 74L, 81L, 84L, 73L, 72L, 73L, 71L, 71L, 73L, 72L, 79L, 72L, 71L, 76L, 72L, 75L, 73L, 71L, 70L, 79L, 69L, 70L, 70L, 70L, 77L, 69L, 69L, 68L, 69L, 73L, 69L, 69L, 74L, 68L, 69L, 70L, 74L, 68L, 68L, 68L, 68L, 68L, 68L, 80L, 69L, 72L, 80L, 80L, 81L,

Set marker size in plotly

╄→尐↘猪︶ㄣ 提交于 2019-12-01 05:59:57
How can I change the marker size in plotly in R on a map? If I set the size argument to any number it makes it the same, too big size. And if I map it to a variable in my data, the markers are to small to really be able to tell the difference in the first place. Ideally I would like to increase the base size and keep the proportional aspect through mapping to the variable. Reproducible example: library(data.table) library(plotly) library(dplyr) sample <- data.table(Region=c("Illinois","Illinois","California","California","Texas","Texas"), code=c("IL","IL","CA","CA","TX","TX"), Group=c("A","B")

Exporting PNG files from Plotly in R without internet

落花浮王杯 提交于 2019-12-01 04:46:30
In this question, Exporting PNG files from Plotly in R I asked how to export Plotly plots to disk. I used the function plotly_IMAGE , but later discovered that the function uses the Plotly internet servers. The question is, now that Plotly JavaScript is local, how can I create a png local file without internet? I tried this code, without success: library(plotly) png(filename = "test.png") plot_ly(x = 1:10) dev.off() The idea is to make it programaticaly, without click on export button over the chart. They've added a new export function to the plotly package. But to my knowledge it does the

How can I hide data gaps in plotly?

寵の児 提交于 2019-12-01 04:25:18
I have datasets that may include large gaps in data, and I want to chart the data without plotly automatically filling in the gaps with blank space. Example Chart from my app: Data: +------------+-----------+------------+ | date | responses | percentage | +------------+-----------+------------+ | 2017-02-13 | 4 | 0.6296 | | 2017-02-14 | 1 | 0.7963 | | 2017-02-15 | 4 | 0.7315 | | 2017-02-16 | 2 | 0.4213 | | 2017-03-02 | 1 | 0.8611 | | 2017-03-03 | 1 | 0.8148 | | 2017-03-04 | 2 | 0.4444 | +------------+-----------+------------+ Alternate Example JSFiddle: https://jsfiddle.net/4h922ca9/ Plotly

Interactive selection in ggplotly with geom_hex() scatterplot

廉价感情. 提交于 2019-12-01 03:23:17
I am trying to create a scatterplot matrix with interactive selection between geom items in individual matrix plots. This works when I am dealing with geom_points (inside ggpairs()). When a user selects points in any of the 3 bottom-left individual matrix plots, then they can see the points highlighted in the other matrix plots. Below is a simple example: library(GGally) library(ggplot2) library(plotly) dat = mtcars[,1:3] p <- ggpairs(dat) ggplotly(p) However, in my case, I am aiming to use geom_hex instead of geom_points. I am hoping to develop a way that a user can highlight a hexagon(s) in

How can I hide data gaps in plotly?

烂漫一生 提交于 2019-12-01 02:42:21
问题 I have datasets that may include large gaps in data, and I want to chart the data without plotly automatically filling in the gaps with blank space. Example Chart from my app: Data: +------------+-----------+------------+ | date | responses | percentage | +------------+-----------+------------+ | 2017-02-13 | 4 | 0.6296 | | 2017-02-14 | 1 | 0.7963 | | 2017-02-15 | 4 | 0.7315 | | 2017-02-16 | 2 | 0.4213 | | 2017-03-02 | 1 | 0.8611 | | 2017-03-03 | 1 | 0.8148 | | 2017-03-04 | 2 | 0.4444 | +----

How to simultaneously apply color/shape/size in a scatter plot using plotly?

时光总嘲笑我的痴心妄想 提交于 2019-12-01 02:40:27
I am trying to create (in plotly ) a scatterplot which distinguishes the points of the same series by two (or three) aesthetics -- color, shape, size. Ultimately the objective is to be able to toggle groups of points on/off via the legend, using any of the three aesthetics. This works well for one aesthetic. [Added 2016-06-20] To expand on the desired interactive behavior: The idea is, once the figure is shown, to be able to toggle groups of points by clicking on any of the legends. For example (in the sample data below), if I were to click on y in the legend, it would hide/show points #4, 5