plotly-dash

Plotly: Change order of elements in Sunburst Chart

旧时模样 提交于 2021-01-27 19:30:40
问题 I am currently using plotly express to create a Sunburst Chart. However, i realized that children are ordered alphabetical for nominal values. Especially for plotting months that is pretty unlucky... Do you know how to handle that issue? Maybe a property or some workaround? Below there is an example so you can try it yourself. Thanks in advance! import plotly.express as px import pandas as pd import calendar months = [x for x in calendar.month_name if x] #Create Dataframe data = [] for m in

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

How to dynamically set a default value in a dcc.Dropdown when options come from a callback?

房东的猫 提交于 2021-01-05 07:22:25
问题 Here is a minimal example of a Dash app code (app.py): # Libraries import csv import pandas as pd import dash import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output, State # CSV files generation row_list = [ ["SN", "Name", "Quotes"], [1, "Buddha", "What we think we become"], [2, "Mark Twain", "Never regret anything that made you smile"], [3, "Oscar Wilde", "Be yourself everyone else is already taken"] ] with open('quotes.csv', 'w',

Making table sortable in Dash html Table component

眉间皱痕 提交于 2021-01-05 07:18:54
问题 I have a table in my app with Dash, but I made it using the html components and not with the DataTable of Dash. The app is quite big and already configured, so I would like to avoid rewriting it. In html there is the <table class="sortable"> which makes the table sortable. However, when I construct the table with dash, where should I write this attribute? Here is my table code: def generate_table(dataframe, max_rows=1000): return html.Table([ html.Thead( html.Tr([html.Th(col) for col in

Plotly-Dash stock app in python, with clientside callback (yaxis autoscale on xaxis zoom)

时光总嘲笑我的痴心妄想 提交于 2021-01-05 07:07:40
问题 I'm creating a simple stock chart app in dash-plotly (python) whith an xaxis slider. When sliding the xaxis, I want the yaxis to dynamically rescale to the view. I think I have managed to get the callback function to trigger when sliding the xaxis scale through the 'relayoutData' hook. But instead of updating the yaxis the script throws errors. I'm not sure of the proper syntax to update layout from a callback function. Any ideas? Here is my code so far. It runs, but yaxis is set at run time,

Plotly-Dash: How to show the same selected area of a figure between callbacks?

落花浮王杯 提交于 2021-01-01 10:59:36
问题 Consider a plotly figure where you can select polynomial features for a line fit using JupyterDash: If you select an area and then choose another number for polynomial features, the figure goes from this: ... and back to this again: So, how can you set things up so that the figure displays the same area of the figure every time you select another number of features and trigger another callback? Complete code: import numpy as np import plotly.express as px import plotly.graph_objects as go

Plotly-Dash: How to show the same selected area of a figure between callbacks?

一曲冷凌霜 提交于 2021-01-01 10:58:52
问题 Consider a plotly figure where you can select polynomial features for a line fit using JupyterDash: If you select an area and then choose another number for polynomial features, the figure goes from this: ... and back to this again: So, how can you set things up so that the figure displays the same area of the figure every time you select another number of features and trigger another callback? Complete code: import numpy as np import plotly.express as px import plotly.graph_objects as go

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

Python Plotly: Adding a horizontal line to a scatter plot that has multiple subplots

徘徊边缘 提交于 2020-12-12 10:24:45
问题 I have a scatter plot that is running on Plotly dash. This is the code: import dash import dash_core_components as dcc import dash_html_components as html import plotly import plotly.graph_objs as go from plotly.subplots import make_subplots import numpy as np fig = make_subplots(rows=2, cols=3, vertical_spacing=0, horizontal_spacing=0.05, shared_xaxes=True, shared_yaxes=False) fig.add_trace(go.Scatter(x=list(range(40)), y=np.random.randint(20, 40, 40), line_color='#fae823', showlegend=False,