plotly-python

Horizontal Line in Python Plotly Scatter plot

血红的双手。 提交于 2021-01-07 03:52:19
问题 I'm looking for a way to draw two horizontal lines in a Plotly Scatter plot. My x-axis index is not fixed and keep changing everytime. So I'm looking for a Horizontal line at y = 5 and y = 18 passing horizontally across the chart I looked here for a solution but I'm not sure how to use layouts with Plotly express My code for scatter plot: import plotly.express as px df = pd.DataFrame({"x":[0, 1, 2, 3, 4,6,8,10,12,15,18], "y":[0, 1, 4, 9, 16,13,14,18,19,5,12]}) fig = px.scatter(df, x="x", y="y

Plotly Dash Callback error updating Output Graph

℡╲_俬逩灬. 提交于 2021-01-07 01:26:12
问题 I am trying to create an interactive chart using Plotly Dash. The code reads the symbol name from the user and pullout historical data from yahoo finance and plots a candlestick chart with an slider. As I run the code I am getting this error in the browser: Callback error updating output-graph.children The source code is: import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.graph_objs as go import pandas

Plotly Dash Callback error updating Output Graph

一个人想着一个人 提交于 2021-01-07 01:20:44
问题 I am trying to create an interactive chart using Plotly Dash. The code reads the symbol name from the user and pullout historical data from yahoo finance and plots a candlestick chart with an slider. As I run the code I am getting this error in the browser: Callback error updating output-graph.children The source code is: import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.graph_objs as go import pandas

Draw multiple arrows using plotly python

邮差的信 提交于 2021-01-01 08:14:53
问题 There is an example about multiple annotations, it simply duplicate the go.layout.Annotation() to draw 2 arrows. But I need to draw more than 100+ arrows, I don't know how. The go.layout.Annotation() is tuple type and accepts dict() for each arrow, is there any easy way to add more dict() to tuple() ? Thank you. 回答1: I solved my own question. fig.layout.annotations accepts list, parameters of each arrow is a dict(). So the idea is to create a list of many dict(), and then use fig.update

Draw multiple arrows using plotly python

ぐ巨炮叔叔 提交于 2021-01-01 08:14:52
问题 There is an example about multiple annotations, it simply duplicate the go.layout.Annotation() to draw 2 arrows. But I need to draw more than 100+ arrows, I don't know how. The go.layout.Annotation() is tuple type and accepts dict() for each arrow, is there any easy way to add more dict() to tuple() ? Thank you. 回答1: I solved my own question. fig.layout.annotations accepts list, parameters of each arrow is a dict(). So the idea is to create a list of many dict(), and then use fig.update

Plotly-Dash: How to code interactive callbacks for hover functions in plotly dash

邮差的信 提交于 2020-12-13 03:19:18
问题 Is it possible to have a text field at the bottom of a graph in dash that displays the text for the point they are on (showing hover data as plain text). So the text box will be able to make changes when users hover over a certain point. I have defined a dcc.Graph component and the app layout but am not sure how to define the callback function for the hoverdata. I have used the below code to define dcc.Graph and app.layout fig = go.Figure(data=plot_data, layout=plot_layout) app.layout = html

Plotly: How to show more than 2 x-axes titles/ranges on the same subplot?

戏子无情 提交于 2020-12-12 05:40:35
问题 I'm using Plotly and making scatter plot subplots with a shared y-axis and different x-axes. I have attempted to use the figure object (fig['layout'][data index]) syntax to show multiple stacked x-axes and their respective ranges. I have only been successful in showing two xaxes and ranges per subplot by assigning 'top' and 'bottom' to the side attribute of the figure layout. The 2nd column from the right in figure below should show titles/ranges for series T5, T6, and T7 but only the title

Change Color of an Entire Trace on Hover/Click in Plotly

二次信任 提交于 2020-11-29 10:19:19
问题 I have the current figure in plotly (jupyter notebook code below), and was hoping to create the effect whereby when you hover or click over each trace, the whole trace is highlighted a different colour (in this example red). I tried implementing these examples from SOF: Plotly in Python: how to highlight a trace on hover? & How do I highlight an entire trace upon hover in Plotly for Python? with no luck. If anyone could help that would be amazing. Currently each trace remains lightgrey.

Change Color of an Entire Trace on Hover/Click in Plotly

懵懂的女人 提交于 2020-11-29 10:15:29
问题 I have the current figure in plotly (jupyter notebook code below), and was hoping to create the effect whereby when you hover or click over each trace, the whole trace is highlighted a different colour (in this example red). I tried implementing these examples from SOF: Plotly in Python: how to highlight a trace on hover? & How do I highlight an entire trace upon hover in Plotly for Python? with no luck. If anyone could help that would be amazing. Currently each trace remains lightgrey.

Plotly Dash - Gradient Lines

可紊 提交于 2020-11-29 09:39:05
问题 Is it possible using Plotly Dash to create line graphs in which the line colors are gradient (purely for aesthetics) ? I tried using something like 'line': {'color': 'linear-gradient(90deg, red, red 60%, white)' } example of entire graph code in plotly dassh dcc.Graph( id='MORTGAGE_RATES', figure={ 'data': [ { "x": MORTGAGE30US['date'],"y": MORTGAGE30US['value'],"mode": "lines","name": '30 YR', 'line': {'color': 'linear-gradient(90deg, red, red 60%, white)' }}, { "x": MORTGAGE15US['date'],"y"