plotly

Plotly: How to add a median line on a box plot

╄→尐↘猪︶ㄣ 提交于 2020-05-13 18:18:08
问题 I would like to add trace of a median line on my box plot. like this Here are my plots so far: library(plotly) p <- plot_ly(y = ~rnorm(50), type = "box") %>% add_trace(y = ~rnorm(50, 1)) p 回答1: Just start out with a scatter plot using plot_ly(..., type='scatter', mode='lines', ...) , and follow up with one add_boxplot(...' inherit=FALSE, ...) per box plot. Here's how you do it for an entire data.frame : Complete code with sample data: library(dplyr) library(plotly) # data df <- data.frame

Plotly missing orca

五迷三道 提交于 2020-05-13 14:11:37
问题 I have small problem when exporting static chart using plotly. Plotly does not correctly recognize that I have orca installed and I have still error related to missing orca. I try to change the orca directory but it is still not working. Anyone who knows what is wrong? My code: import plotly.graph_objects as go import orca import plotly #%% fig = go.Figure(data=go.Candlestick(x=pricedata.index, open=pricedata['bidopen'], high=pricedata['bidhigh'], low=pricedata['bidlow'], close=pricedata[

plotly: range slider on x-axis (date) with custom start / end date

不想你离开。 提交于 2020-05-13 06:53:40
问题 Is there an option to use the rangeslider option in the plotly package so that you add a slider AND specify which range is the default. Right now, the following code adds the slider but by default the entire range of dates is selected. library(plotly) df <- data.frame(Date = seq(as.Date("2016-01-01"), as.Date("2016-08-31"), by="days"), Value = sample(100:200, size = 244, replace = T)) p <- plot_ly(data = df, x = Date, y = Value, type = "line") %>% layout(xaxis = list(rangeslider = list(type =

Is there a way to normalize the scales of axes in subplots in cufflinks library python?

你。 提交于 2020-04-30 08:47:09
问题 I have used cufflinks to plot a few subplots, their scale ranges are different. I want same scales so I can compare the subplots. Is there a way to customize the axes of each subplot in cufflinks? This link shows the picture of the subplots, the subplots of row 1, column1 and column2 have different ranges on the y axes. Is there a way to change the range of graph DRV.FV to -5 to 10? MCVE: df=cf.datagen.lines(4) df.iplot(subplots=True, subplot_titles=True, legend=False) I have taken this from

Is there a way to normalize the scales of axes in subplots in cufflinks library python?

拜拜、爱过 提交于 2020-04-30 08:46:45
问题 I have used cufflinks to plot a few subplots, their scale ranges are different. I want same scales so I can compare the subplots. Is there a way to customize the axes of each subplot in cufflinks? This link shows the picture of the subplots, the subplots of row 1, column1 and column2 have different ranges on the y axes. Is there a way to change the range of graph DRV.FV to -5 to 10? MCVE: df=cf.datagen.lines(4) df.iplot(subplots=True, subplot_titles=True, legend=False) I have taken this from

Combining renderUI, dataTableOutput, renderDataTable, and reactive

怎甘沉沦 提交于 2020-04-30 06:28:21
问题 This is somewhat of an expansion of this post: I would like to have the DT::renderDataTable inside the renderUI and then have the output of the renderUI used in the reactive . This is what I'm doing: suppressPackageStartupMessages(library(dplyr)) suppressPackageStartupMessages(library(plotly)) suppressPackageStartupMessages(library(shiny)) #data.frames to be used in the server set.seed(1) coordinate.df <- data.frame(coordinate_id = paste0("c", 1:1000),x = rnorm(1000), y = rnorm(1000),

How do I highlight an entire trace upon hover in Plotly for Python?

本小妞迷上赌 提交于 2020-04-29 07:31:56
问题 I want a trace to be highlighted (color or opacity change) when selected with mouse hover. I have looked into restyle functionality, but it may not be appropriate for my use case. It looks like this has been discussed on Github, but I'm not sure if it has been resolved/implemented. Here is an example in Bokeh of what I want to accomplish in Plotly Python: from bokeh.plotting import figure, show, output_notebook from bokeh.models import HoverTool from bokeh.models import ColumnDataSource

plotting 3D surface with plotly (matrix transformation with akima::interp)

自闭症网瘾萝莉.ら 提交于 2020-04-18 05:46:01
问题 In order to plot a surface in plotly with x, y, z, we can use the function interp to create the data (as input for the add_surface function in plotly) This article give the solution. I follow the different steps. With the follow code, we can plotly a surface with markers. library(akima) library(plotly) x=rep(seq(-1,5,0.2),time=31,each=1) y=rep(seq(-1,5,0.2),time=1,each=31) df=data.frame(x=x,y=y, z=2*x+y-1.4) fig <- plot_ly()%>% add_markers(data=df,x = ~x, y = ~y, z = ~z, marker = list(color =

Plotly: How to use the same color scheme on two subplots?

你。 提交于 2020-04-10 03:32:37
问题 I am trying to plot two scatter subplots with plotly whereby the colour automatically chosen in the two sub-plots is the same, but I cannot find a way to do so. Following is a code snippet: import plotly as py import plotly.tools as to import numpy as np import plotly.graph_objs as go fig=to.make_subplots(rows=1,cols=2,subplot_titles=['Plot 1','Plot 2']) X=[0,50,100,150,200,250,300,350,400,450,500] Y=[1,2,3,4,5,6,7,8,9,10,11] Z=Y.copy() for i in np.arange(11): if i==0: Z[0]=Y[0] else: Z[i]=Y

Plotly: How to use the same color scheme on two subplots?

社会主义新天地 提交于 2020-04-10 03:31:17
问题 I am trying to plot two scatter subplots with plotly whereby the colour automatically chosen in the two sub-plots is the same, but I cannot find a way to do so. Following is a code snippet: import plotly as py import plotly.tools as to import numpy as np import plotly.graph_objs as go fig=to.make_subplots(rows=1,cols=2,subplot_titles=['Plot 1','Plot 2']) X=[0,50,100,150,200,250,300,350,400,450,500] Y=[1,2,3,4,5,6,7,8,9,10,11] Z=Y.copy() for i in np.arange(11): if i==0: Z[0]=Y[0] else: Z[i]=Y