plotly

Plot.ly. Using slider control with multiple plots

寵の児 提交于 2019-12-08 08:22:57
问题 I'd like to add the slider control to my plotly graph (pic) to control all elements simultaneously. I can easily add slider control to graph with only one line. In this case I put a list of plots (in form of dicts) into data variable: plotly.graph_objs.Figure ( data = [plot1,plot2] , layout = layout) And it's work quite good. But in order to plot multiple lines on the same graph, I have to put list of lists with plots into data variable ( have I ? ) : plotly.graph_objs.Figure ( data = [[plot1

Save .png by webshot in R

和自甴很熟 提交于 2019-12-08 07:57:22
问题 I'm using webshot to save a png file from HTML : p <- plot_ly(plotly::wind, r = ~r, t = ~t) %>% add_area(color = ~nms)%>% layout(radialaxis = list(ticksuffix = "%"), orientation = 270) saveWidget(as.widget(p), "temp.html") webshot("temp.html",file = "temp.png",cliprect = "viewport") This is giving me a plot like this. It returns a small image in the upper left corner. What should I do to have a full-size image in a center? 来源: https://stackoverflow.com/questions/48289771/save-png-by-webshot

How to add arrow below the y axis in plotly 3D scatter plot?

六月ゝ 毕业季﹏ 提交于 2019-12-08 07:50:54
问题 Creating 3D scatter plot with annotation by plotly can be done following the example: library(plotly) whole_dat = data.frame(x1 = rnorm(50), y1 = rnorm(50), z1 = rnorm(50)) p <- plot_ly() %>% add_markers( x = whole_dat$x1, y = whole_dat$y1, z = whole_dat$z1) p = layout(p, scene = list( annotations = list(list( x = 0.3, y = -3, z = -0.1, text = "12345", textangle= 0, ax = 0, ay = -75, xref='x', axref='x', yref = 'paper', ayref = 'paper', zref = 'paper', #showarrow=TRUE, arrowcolor= "black",

Plotly Python: Align X-Axes in a grouped bar chart with multiple Y-axis

北城以北 提交于 2019-12-08 07:42:57
问题 I have a grouped bar chart with two y axis each of them on a different scale. I am trying to align x-axis(y=0) of both the groups. I found few links link1 and link2 in which setting rangemode='zero' should work, however my data consists of negative values due to which I guess setting rangemode to zero isn't working. Here is my code: import plotly.offline as plt import plotly.graph_objs as go traces = [go.Bar(x=[1,2,3,4], y=[-1,2,-3,4], name='y actual'), go.Bar(x=[1], y=[0], name='y dummy',

generate seasonal plot, but with fiscal year start/end dates

别说谁变了你拦得住时间么 提交于 2019-12-08 07:18:56
问题 Hello! Is there a way to index a chart to start and end at specific points (which may be out of numeric order)? I have data that begins October 1st, and ends September 31st the following year. The series repeats through multiple years past, and i want to build a daily seasonality chart. The challenge is the X axis is not from low to high, it runs 10-11-12-1-2-3-4-5-6-7-8-9. Question 1: Can you order the index by month 10-11-12-1-2-3-4-5-6-7-8-9? while, being compatible with %m-%d formatting,

R plot dynamic wind direction as arrow over time

左心房为你撑大大i 提交于 2019-12-08 07:18:49
问题 I want to plot the wind over a very long time,thus a dynamic plot is a nice choice for others to choose the time range. And I want to display the wind direction as arrows ; wind speed could be line . But it will be messy if I add arrows to every line above, and it seems hard to add more date to x axis. What the final result I want to get is like this: Is it possible to plot the wind-arrow plot in R? Plus: here is the demo data for plot structure(list(date = c("2016-04-01", "2016-04-01", "2016

Python Plotly Sankey Graph not showing up

本小妞迷上赌 提交于 2019-12-08 06:40:37
问题 Was wondering if anyone can help figure out why this Sankey diagram is not working. I am pretty sure I followed the proper syntax and conventions to use the module. Been banging my head on the table because of this. import plotly.offline data_trace = {'domain': {'x': [0, 1], 'y': [0, 1]}, 'height': 772, 'link': {'label': ['EM', 'GWF9C51E', 'GWF9C511', 'GWF9C51E Sensor Set', 'GWF9C511 Sensor Set'], 'source': [0, 1, 3, 1, 4, 2, 0, 2], 'target': [1, 3, 1, 0, 2, 0, 2, 4], 'value': [40, 76, 29, 86

How do I make stacked area chart in plotly.js with correct values?

天涯浪子 提交于 2019-12-08 05:52:35
问题 There is an example of a stacked area chart: var stacksDiv = document.getElementById("myDiv"); var traces = [ {x: [1,2,3], y: [2,1,4], fill: 'tozeroy'}, {x: [1,2,3], y: [1,1,2], fill: 'tonexty'}, {x: [1,2,3], y: [3,0,2], fill: 'tonexty'} ]; function stackedArea(traces) { for(var i=1; i<traces.length; i++) { for(var j=0; j<(Math.min(traces[i]['y'].length, traces[i-1]['y'].length)); j++) { traces[i]['y'][j] += traces[i-1]['y'][j]; } } return traces; } Plotly.newPlot(stacksDiv, stackedArea

Can't create 3d surface with dataframe plot_ly

别等时光非礼了梦想. 提交于 2019-12-08 05:42:16
问题 I have been trying to create a 3d surface with plotly but I couldn't. What I did is the following: dataf <- data.frame(x=as.numeric(1:50), y=as.numeric(1:50), z=as.numeric(1:5)) And then plot_ly() %>% add_trace(data = dataf, x=dataf$x, y=dataf$y, z=dataf$z, type="mesh3d" ) But the problem is that it prints me an empty graph. Any help is appreciated. 来源: https://stackoverflow.com/questions/44449817/cant-create-3d-surface-with-dataframe-plot-ly

Plotly-Dash: Want two stacked bar charts side by side from single df column

心不动则不痛 提交于 2019-12-08 05:08:17
问题 I am trying to get two stacked bar charts side by side but cannot figure it out. Here's an example df: Field Issue Police Budget cuts Research Budget cuts Police Time consuming Banking Lack of oversight Healthcare Lack of support Research Bureaucracy Healthcare Bureaucracy Banking Mistrust What I want is a stacked bar chart of of field first. It will have a height of 8 broken down by 2 police, 2 x research etc. Then I want a stacked bar chart of Issue next to the first chart. This second one