0

enter image description hereI am using stack bar to present two parameters for few companies with a facet for three years it all goes well,however I would like to add the label in the graph at least for one of the parameters when using text-it destroy the other parameter view , I would like to see both parameters and text at least for the current_ratio parameter this is the code :

import dash
import plotly.offline as pyo
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 as pd
import plotly.express as px
#quick_ratio

df=pd.read_excel(r'C:\Users\[![enter image description here][1]][1]example.xlsx',sheet_name='Sheet1')

fig=px.bar(

df,
x='company',
y=['current_ratio','quick_ratio'],
facet_col='y',


)
fig.update_layout(barmode='stack')
app=dash.Dash(__name__)
app.layout=html.Div([
html.H1('M_Aviv liquidity  '),
dcc.Graph(id='graph',figure=fig)
])

app.run_server(debug=True,port=8009)
zachi
  • 511
  • 4
  • 13
  • This is not very useful: `df=pd.read_excel(r'C:\Users\[![enter image description here][1]][1]example.xlsx',sheet_name='Sheet1')` – vestland Sep 02 '20 at 08:10
  • added, sorry for this , hope now this is clearer – zachi Sep 02 '20 at 17:53
  • No. For several reasons. (1) don't provide data as a screenshot. (2) provide a runnable code snippet to reproduce your figure. Please read [ask] a question. And please share your dataframe, or a sample of your dataframe in the way described [here](https://stackoverflow.com/questions/63163251/pandas-how-to-easily-share-a-sample-dataframe-using-df-to-dict/63163254#63163254). It will be worth your time. – vestland Sep 02 '20 at 18:22
  • df=pd.DataFrame({0: {'Aura': 'Aura', '2019': 2018, '01/12/2019': '01/12/2018', ' 0.87 ': 0.9, ' 0.07 ': 0.07}, 1: {'Aura': 'Aura', '2019': 2017, '01/12/2019': '01/12/2017', ' 0.87 ': 0.89, ' 0.07 ': 0.04}, 2: {'Aura': 'Dunietz', '2019': 2019, '01/12/2019': '01/12/2019', ' 0.87 ': 1.24, ' 0.07 ': 0.47}, 3: {'Aura': 'Dunietz', '2019': 2018, '01/12/2019': '01/12/2018', ' 0.87 ': 1.15, ' 0.07 ': 0.35}} ) – zachi Sep 02 '20 at 18:59
  • I follow your instructions I hope now it is OK , the original data include additional rows for additional companies – zachi Sep 02 '20 at 19:01
  • @zaci Well, at least you're on the right track. But I assume you would like anyone attempting to help you spend their time on an answer, and not reproducing your code. So please include your data sample ***in your question***. And not in a comment. As your question is put together now, we'll have to (1) copy your comment, (2) paste it into your question, (3) edit your code to make it run. And we're ***still*** not sure it will produce your figure. So please save us, and ***yourself*** some time by setting up a proper question. – vestland Sep 02 '20 at 19:06

0 Answers0