plotly

Plotly: How to set values for major ticks / gridlines for x-axis?

﹥>﹥吖頭↗ 提交于 2020-05-29 10:38:09
问题 Background: This question is related, but not identical, to Plotly: How to retrieve values for major ticks and gridlines?. A similar question has also been asked but not answered for matplotlib here: How do I show major ticks as the first day of each months and minor ticks as each day? Plotly is fantastic , and maybe the only thing that bothers me is the autoselection of ticks / gridlines and the labels chosen for the x-axis like in this plot: Plot 1: I think the natural thing to display here

Plotly: How to annotate figure by a list of strings and a list of coordinates?

本小妞迷上赌 提交于 2020-05-28 06:57:45
问题 I am plotting a certain list, Z[i, j] of length D, using matplotlib along with the annotation of the points taken from another list, index_word_map[i], as follows: plt.scatter(Z[:,0], Z[:,1]) for i in range(D): plt.annotate(s=index_word_map[i], xy=(Z[i,0], Z[i,1])) plt.show() Now, I want to do the same using plotly or plotly express. I can plot the points using plotly express as follows: X = [] Y = [] for i in range(D): x = Z[i,0] y = Z[i,1] X.append(x) Y.append(y) fig = px.scatter(x=X, y=Y)

Draw Sankey Diagram from dataframe

依然范特西╮ 提交于 2020-05-28 04:31:09
问题 I have a dataframe: Vendor Name Category Count AKJ Education Books 846888 AKJ Education Computers & Tablets 1045 Amazon Books 1294423 Amazon Computers & Tablets 42165 Amazon Other 415 Flipkart Books 1023 I am trying to draw a sankey diagram using the above dataframe, with the source being Vendor Name and target being Category , and the flow or width being the Count . I tried using Plotly, but no sucess. Does anyone has a solution with Plotly for making a Sankey Diagram? Thanks 回答1: The answer

Python: How to make shaded areas or alternating background color using plotly?

只谈情不闲聊 提交于 2020-05-27 12:46:31
问题 Using only these few lines of code from plot.ly will give you the plot below in a jupyter notebook: Snippet 1: import plotly import cufflinks as cf from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot init_notebook_mode(connected=True) iplot(cf.datagen.lines().iplot(asFigure=True, kind='scatter',xTitle='Dates',yTitle='Returns',title='Returns')) Plot 1: How can you set it up so you can have alternating bakcground colors in the plot below like it was shown in this post

Python: How to make shaded areas or alternating background color using plotly?

北战南征 提交于 2020-05-27 12:46:05
问题 Using only these few lines of code from plot.ly will give you the plot below in a jupyter notebook: Snippet 1: import plotly import cufflinks as cf from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot init_notebook_mode(connected=True) iplot(cf.datagen.lines().iplot(asFigure=True, kind='scatter',xTitle='Dates',yTitle='Returns',title='Returns')) Plot 1: How can you set it up so you can have alternating bakcground colors in the plot below like it was shown in this post

plot.ly(dash_core_components) slider color change

六眼飞鱼酱① 提交于 2020-05-27 04:18:13
问题 I've met plot.ly dash yesterday for the first time and created some interactive plot. And I added dash_core_components.Slider() object like below code. dcc.Slider( id='month--slider', min=0, max=12, value=12, step=None, marks={'1': '1', '6': '6', '12': {'label': '12', 'style': {'color': 'red'}}} ) I've read help(dcc.Slider) but I couldn't find the way to change the skyblue color of my slider below. So my question here...Is it possible to change the color(or style) of default slider of plot.ly

plot.ly(dash_core_components) slider color change

白昼怎懂夜的黑 提交于 2020-05-27 04:16:34
问题 I've met plot.ly dash yesterday for the first time and created some interactive plot. And I added dash_core_components.Slider() object like below code. dcc.Slider( id='month--slider', min=0, max=12, value=12, step=None, marks={'1': '1', '6': '6', '12': {'label': '12', 'style': {'color': 'red'}}} ) I've read help(dcc.Slider) but I couldn't find the way to change the skyblue color of my slider below. So my question here...Is it possible to change the color(or style) of default slider of plot.ly

Plotly: How to add borders and sidelabels to subplots, and syncronize panning?

淺唱寂寞╮ 提交于 2020-05-25 05:01:51
问题 The following graph is my attempt to use Plotly in Python (code at the very bottom) to do 2x2 plot. I am trying to improve the graph but I can't seem to do the following: Borders on each of the subplots Synchronize panning and zooming across all the plots. Although I am using shared_xaxes and shared_yaxes, it only works for the row and column of the subplot. So if I pan around on the lower left graph, the upper right graph remains unmoved. Sidelabels to label the subplots. See for e.g. Any

How to reverse axis values when using plotly?

久未见 提交于 2020-05-23 12:27:29
问题 Here is the program I used: library(plotly) mydata = read.csv("data_to_plot.txt") df = as.data.frame(mydata) p <- df %>% group_by(X) %>% plot_ly(x = ~Y, y = ~X, z = ~Z, type = "scatter3d", mode = "lines") p and below is an excerpt of "mydata": df[1:12,] X Y Z 1 1 0.2818017 0.0005993884 2 1 0.2832173 0.0007896421 3 1 0.2846330 0.0010293849 4 1 0.2860487 0.0013282462 5 1 0.2874643 0.0016969544 I would like to have the X values reversed on the X-axis, but can't find how to modify my program.

How to show timestamp x-axis in Python Plotly

橙三吉。 提交于 2020-05-17 07:52:49
问题 I want to plot this data to evaluate data availability. I used the following plotting code in Plotly. import datetime import plotly.express as px fig = px.bar(df, x=df.index, y="variable", color='value', orientation="h", hover_data=[df.index], height=350, color_continuous_scale=['firebrick', '#2ca02c'], title='', template='plotly_white', ) The result is just like what I want below. But, the x-index show numbers. I want a timestamp (month+year) on the x-axis, instead. Edit Adding the fllowing