plotly

plotly plots in jupyter notebooks: Validation fails when saving

时光毁灭记忆、已成空白 提交于 2019-12-21 11:35:53
问题 I'am new to plotly and I'am having a problem with my plots when generating them inside jupyter notebooks. Whenever I generate a plot, evrything works fine, but when I try to save the notebook I get an error message telling me that the notebook validation failed because it's not valid under any of the given schemas (example taken straight from the plot.ly webiste). Here is an example: import plotly.plotly as py iplot([{"x": [1, 2, 3], "y": [3, 1, 6]}]) I get the following message when I try to

Add custom data label in ggplotly scatterplot

做~自己de王妃 提交于 2019-12-21 05:44:09
问题 I would like to display the Species for each data point when the cursor is over the point rather than the than the x and y values. I use the iris dataset. Also I want to be able to click on a data point to make the label persistent and not get disapperaed when I choose a new spot in the plot. (if possible ). The basic is the label. The persistence issue is a plus. Here is my app: ## Note: extrafont is a bit finnicky on Windows, ## so be sure to execute the code in the order ## provided, or

Adjust the size of plotly charts in slidify

旧城冷巷雨未停 提交于 2019-12-21 05:27:08
问题 I've created a plotly chart in R and then save the plot via htmlwidget so the plot can called in slidify. I played with width and height , in both layout argument and index.Rmd to fit the plot on a slidify slide but the final result always cut the bottom portion of the chart when some texts are added together. How can I truly adjust the size of the plotly chart in slidify? The code in R script ## first slide date <- seq(from = as.POSIXct("2015/4/1"), to = as.POSIXct("2015/10/1"), by = "month"

Show legend and label axes in plotly 3D scatter plots

﹥>﹥吖頭↗ 提交于 2019-12-21 03:53:06
问题 Sorry for keeping you busy with plotly questions today. Here would be another one: How would I show the legend and axes labels on plotly's new 3D scatter plots? E.g., if I have the following scatter plot in 2D that produced everything fine, I added another dimension but the axes labels don't show anymore (see code below), and the same problem with the legend. Any tips? Thanks! traces = [] for name in ('Iris-setosa', 'Iris-versicolor', 'Iris-virginica'): trace = Scatter3d( x=Y[y==name,0], y=Y

Plotly: Multiple plots with 'linked' interactivity

余生长醉 提交于 2019-12-20 18:08:13
问题 I am trying to create a series of plots to embed in a website where the interactivity is 'linked' like in the animation below. I cannot find examples of this functionality in Plotly (or other embeddable plotting packages). The first two plots just show a synchronized vertical bar, the bottom plot shows the corresponding values of plot 1 in a scatterplot. Questions: Is it possible to create this type of 'linked' plots using Plotly? If so, can anyone point me in a direction on how to accomplish

Making a stacked bar plot based on ranges in R and plotly

元气小坏坏 提交于 2019-12-20 07:40:06
问题 I want to create a stacked bar chart in R and plotly using iris dataset. In the x-axis, I want to set limits like iris_limits below in the code and the y-axis should contain all the Sepal.Length values which fit into these ranges. I want to pass the values as a single vector. Also, if the limits can be made dynamic by understanding the range of the Sepal.Length instead of hard coding it, please help. I have written a basic script with values to give you an idea. Thanks. library(plotly) iris

Creating a horizontal bar chart in R to display sequence of activities

允我心安 提交于 2019-12-20 06:33:59
问题 The dataset "patients" is an eventlog of patients visiting a clinic and getting treatment. The script below gives a data frame with traces or sequence of activities in the eventlog, trace_id and absolute frequency of the cases following the particular trace. I wish to create a dynamic horizontal bar chart using ggplot2 or plotly such that the traces are represented like the snapshot attached with the absolute frequency in % at the top of the bar with axes labels. Thanks and please help!

Changing line thickness and opacity in scatterplot on onRender() htmlWidgets in R

我的梦境 提交于 2019-12-20 06:32:31
问题 I am hoping to make a plot using the R package htmlwidgets' onRender() function in which a user can click on a point and a line is drawn. I have the crux of it working right now where a gray line is drawn at its default thickness and probably its default opaqueness. However, I have been stuck on changing the thickness of the line (and possibly changing the opaqueness of the line, although it may be working and I cannot see it since the line is so thin). I want the line to be very thick and

How can I combine a line and scatter on same plotly chart?

你说的曾经没有我的故事 提交于 2019-12-20 03:14:28
问题 The two separate charts created from data.frame work correctly when created using the R plotly package. However, I am not sure how to combine them into one (presumably with the add_trace function) df <- data.frame(season=c("2000","2000","2001","2001"), game=c(1,2,1,2),value=c(1:4)) plot_ly(df, x = game, y = value, mode = "markers", color = season) plot_ly(subset(df,season=="2001"), x = game, y = value, mode = "line") Thanks in advance 回答1: There are two main ways you can do this with plotly,

Multiple plotly pie charts in one row

♀尐吖头ヾ 提交于 2019-12-20 03:08:23
问题 I am trying to arrange two pie charts in a single row using the subplot function from the plotly package but the resultant plot is not what I expect. I was able to do the same for line charts, etc but I am facing trouble plotting two pie charts in a single row. Following is the code that I have. ds_r <- data.frame(labels = c("Baseline", "DTC", "Detailing", "Flex"), values = c(63.5, 8.5, 20.6, 7.4)) ds_l <- data.frame(labels = c("Baseline"), values = c(100)) plot_right <- plot_ly(ds_r, labels