plotly

Is there a way to start a plot already zoomed on a specific area using plotly?

两盒软妹~` 提交于 2021-01-27 04:49:00
问题 I have a scatter plot made with plotly (specifically offline plotly with the Python API on a Jupyter Notebook) and as you know, plotly makes it easy for the user to zoom and frame specific areas, but I'd like the plot to start already focussed on a specific area of my choosing. I can't find anything relevant in the documentation (maybe because I don't know where to look or what terms to look up). Is there a way to do this, and if so, how? And how does the setting differ when using subplots

Is there a way to start a plot already zoomed on a specific area using plotly?

徘徊边缘 提交于 2021-01-27 04:47:11
问题 I have a scatter plot made with plotly (specifically offline plotly with the Python API on a Jupyter Notebook) and as you know, plotly makes it easy for the user to zoom and frame specific areas, but I'd like the plot to start already focussed on a specific area of my choosing. I can't find anything relevant in the documentation (maybe because I don't know where to look or what terms to look up). Is there a way to do this, and if so, how? And how does the setting differ when using subplots

Plotly-R: How to make a gapped y axis?

*爱你&永不变心* 提交于 2021-01-24 13:47:06
问题 Is it possible to create a plotly bar chart, e.g. any chart from the following website: https://plotly.com/r/bar-charts/ but with the gapped (broken) Y axis? An example from (ggplot2, I believe) attached below: 回答1: To my knowledge, plotly hasn't got any built-in functionality to do this. But it's still possible to make a figure that matches your image using subplots if you: use subplot(fig1, fig2, nrows = 2, shareX=TRUE, margin = <low>) , and adjust the y axes for figure positions [1, 1] and

Plot best fit line with plotly

与世无争的帅哥 提交于 2021-01-24 01:24:42
问题 I am using plotly's python library to plot a scatter graph of time series data. Eg data : 2015-11-11 1 2015-11-12 2 2015-11-14 4 2015-11-15 2 2015-11-21 3 2015-11-22 2 2015-11-23 3 Code in python: df = pandas.read_csv('~/Data.csv', parse_dates=["date"], header=0) df = df.sort_values(by=['date'], ascending=[True]) trace = go.Scatter( x=df['date'], y=df['score'], mode='markers' ) fig.append_trace(trace, 2, 2) # It is a subplot iplot(fig) Once the scatter plot is plotted, I want to plot a best

Plotly: Choose a different intersection of X and Y axes

半世苍凉 提交于 2021-01-23 08:17:06
问题 In Plotly, in order to create scatter plots, I usually do the following: fig = px.scatter(df, x=x, y=y) fig.update_xaxes(range=[2, 10]) fig.update_yaxes(range=[2, 10]) I want the yaxis to intersect the xaxis at x=6 . So, instead of left yaxis representing negative numbers, I want it to be from [2,6] After the intersection, right side of graph is from [6,10]. Likewise, yaxis from below axis goes from [2,6]. Above the xaxis, it goes from [6,10]. How can I do this in Plotly? 回答1: Following on

Plotly: Choose a different intersection of X and Y axes

故事扮演 提交于 2021-01-23 08:15:47
问题 In Plotly, in order to create scatter plots, I usually do the following: fig = px.scatter(df, x=x, y=y) fig.update_xaxes(range=[2, 10]) fig.update_yaxes(range=[2, 10]) I want the yaxis to intersect the xaxis at x=6 . So, instead of left yaxis representing negative numbers, I want it to be from [2,6] After the intersection, right side of graph is from [6,10]. Likewise, yaxis from below axis goes from [2,6]. Above the xaxis, it goes from [6,10]. How can I do this in Plotly? 回答1: Following on

R Plotly: How to set the color of Individual Bars of a Waterfall Chart in R Plot.ly?

别说谁变了你拦得住时间么 提交于 2021-01-23 06:11:53
问题 I am trying to change the color of the individual bars of a waterfall chart using R Plotly. More specifically the first and the last bar, I want it to be blue and yellow respectively. So in the below graph, Group 1 has to be blue and Group 2 has to be yellow. R Plotly Waterfall chart seems to only have the option to set three colors for increasing, decreasing and total bars. Here is the code used to generate the above graph: library(plotly) df <- data.frame(Rank = 1:7, Variable = c("Group 1",

How to plot multiple series/lines in a time series using plotly in R?

拥有回忆 提交于 2021-01-23 01:59:12
问题 I have a time series of several years that I need to plot mm/dd on the x-axis and multiple years on the y-axis using plot_ly. I have generated a sample data here: date<-seq(as.Date("2010-11-22"),as.Date("2016-05-26"),by ="days") sales = runif(2013, 2000, 6000) df = data.frame(date,sales) I plotted this data and get this: plot_ly(df,x= ~date) %>% add_lines(y = ~sales,color=I("red")) Now, I tried to plot multiple y-axis using plot_ly : plot_ly(df, x = ~date) %>% add_lines(y = ~sales, df$date <=

Open tab by clicking on a stacked barchart

我与影子孤独终老i 提交于 2021-01-22 10:47:48
问题 I'm building a stacked barchart containing retweets using R, ggplot and plotly. If a part of a barchart is clicked on, I want a new browser tab to open and show the tweet from this specific date with the indicated amount of retweets. However, when I click on one of the bars in the example below, a different link is opened, indicating that the url´s are not properly connected with the bars. How do I solve this? I have never worked or even seen JavaScript before, so chances are high the answer

How to overlay two plots in same figure in plotly ( Create Pareto chart in plotly )?

拟墨画扇 提交于 2021-01-21 07:30:19
问题 I was trying to plot barplot and scatterplot in the same plot in plotly, but it shows only scatterplot. How to show both the plots? data import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from matplotlib.ticker import PercentFormatter import plotly import plotly.offline as py import plotly.graph_objs as go import plotly.figure_factory as ff import plotly.tools as tls from plotly.subplots import make_subplots from plotly.offline import plot, iplot,