plotly

Saving Dash layout to html

孤者浪人 提交于 2019-12-01 01:54:52
I plotted a bunch of things in a dash layout. I want to save them to an html file so I can look at them later. when I reopen the saved html file, I first see everything correctly. However, within <1s, the page goes blank and I get an error: “Error loading layout”. (see gif below) How can this be fixed? Thanks! This solution is not fully working: You have to save your Webpage complete. To prevent the javascript creating any errors i have removed the bundle(2).js file. This file contains the function dash_renderer which tries to interact with the server and creates issues. <footer> <script id="

Exporting PNG files from Plotly in R without internet

旧巷老猫 提交于 2019-12-01 01:11:47
问题 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

R plotly: preserving appearance of TWO legends when converting ggplot2 with ggplotly

你说的曾经没有我的故事 提交于 2019-12-01 01:06:38
I have come to notice that when converting a ggplot2 plot to an interactive plotly plot using the ggplotly function, strange things may occur. I am plotting a "Punchcard plot", a nice way to present 4 dimensions of a data set: df <- data.frame(cat1 = rep(c("a","b","c"), 3), cat2 = c(rep("A", 3), rep("B", 3), rep("C", 3)), var1 = 1:9, var2 = 10:18) ggplot(df, aes(x=cat1, y=cat2, size= var1, fill = var2)) + geom_point(shape=21) However, when I use ggplotly to convert to interactive, plotly only presents one of the legends: p <- ggplot(df, aes(x=cat1, y=cat2, size= var1, fill = var2)) + geom

Interactive selection in ggplotly with geom_hex() scatterplot

风流意气都作罢 提交于 2019-12-01 00:32:04
问题 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

Removing traces by name using plotlyProxy (or accessing output schema in reactive context)

 ̄綄美尐妖づ 提交于 2019-11-30 23:31:37
I am attempting to use the plotlyProxy() functionality ( Documented here ) to allow users of a shiny application to add and remove traces with minimal latency. Adding traces proves to be relatively simple, but I'm having difficulty figuring out how to remove traces by name (I'm only seeing documented examples that remove by trace number) . Is there a way to remove traces by name using plotlyProxy() ? If not, is there a way that I can parse through the output object to derive what trace numbers are associated with a given name? I can determine the associated trace number of a given name in an

How to plot a vertical line at the x-axis range median position using plotly in Python API?

蹲街弑〆低调 提交于 2019-11-30 22:17:58
I'm trying to plot a vertical line that's dynamically positioned so that when filtering happens, the line will move accordingly. For example, with the below code, I can plot a stationary vertical line at 25K which works with the full dataset as the median, but when the data is filtered to "Americas" only since the x-axis range is now 45K, the line is not at the median position anymore. So how can I plot a vertical line that's positioned at the x-axis range's median position? Thanks import pandas as pd import plotly.graph_objs as go from plotly.offline import init_notebook_mode, iplot init

Interactive scatter plots in R, overlay/hover summary/tooltip as user supplied plot function

泪湿孤枕 提交于 2019-11-30 22:15:28
I have been looking into interactive plots in R. I know that there are several packages to create interactive plots, especially scatterplots, but I am looking for a certain functionality. For example this plot . One can hover with the mouse over the buttons to get a small numerical summary of the data behind the point, i.e. a tooltip. When you have a data set with more variables, it is often nice to explore/visualize scores from PCA, or do multi-dimensional-scaling(MDS). But if one would plot the data in an interactive manner, like the example above, the summary when one hovers over the point

plotly.offline.iplot gives a large blank field as its output in Jupyter Notebook/Lab

时间秒杀一切 提交于 2019-11-30 22:10:38
问题 I am trying to create a Sankey chart in a Jupyter notebook, basing my code on the first example shown here. I ended up with this, which I can run without getting any errors: import numpy as npy import pandas as pd import plotly as ply ply.offline.init_notebook_mode(connected=True) df = pd.read_csv('C:\\Users\\a245401\\Desktop\\Test.csv',sep=';') print(df.head()) print(ply.__version__) data_trace = dict( type='sankey', domain = dict( x = [0,1], y = [0,1] ), orientation = "h", valueformat = "

R plotly: preserving appearance of TWO legends when converting ggplot2 with ggplotly

Deadly 提交于 2019-11-30 20:16:51
问题 I have come to notice that when converting a ggplot2 plot to an interactive plotly plot using the ggplotly function, strange things may occur. I am plotting a "Punchcard plot", a nice way to present 4 dimensions of a data set: df <- data.frame(cat1 = rep(c("a","b","c"), 3), cat2 = c(rep("A", 3), rep("B", 3), rep("C", 3)), var1 = 1:9, var2 = 10:18) ggplot(df, aes(x=cat1, y=cat2, size= var1, fill = var2)) + geom_point(shape=21) However, when I use ggplotly to convert to interactive, plotly only

Removing traces by name using plotlyProxy (or accessing output schema in reactive context)

孤街醉人 提交于 2019-11-30 18:31:35
问题 I am attempting to use the plotlyProxy() functionality (Documented here) to allow users of a shiny application to add and remove traces with minimal latency. Adding traces proves to be relatively simple, but I'm having difficulty figuring out how to remove traces by name (I'm only seeing documented examples that remove by trace number) . Is there a way to remove traces by name using plotlyProxy() ? If not, is there a way that I can parse through the output object to derive what trace numbers