Hello, I am fairly new to Dash so bear with me.
I am plotting a graph with 3 yaxis, however the values and name of the 2 axis on the right are on top of each other, making it difficult to read. Here is the code:
dcc.Graph(id=‘grafico’,
figure={
‘data’: [
{‘x’:df[‘Data’].values, ‘y’:df[‘VA’].values, ‘type’:‘line’, ‘name’:‘Potencia’},
{‘x’:df[‘Data’].values, ‘y’:df[‘I’].values, ‘type’:‘line’, ‘name’:‘Corrente’, ‘yaxis’: ‘y2’},
{‘x’:df[‘Data’].values, ‘y’:df[‘V’].values, ‘type’:‘line’, ‘name’:‘Tensao’, ‘yaxis’: ‘y3’}
],
‘layout’: go.Layout(
title=‘Potencia, Corrente, Tensão’,
yaxis={‘title’: ‘Potencia’, ‘titlefont’ : {‘color’: ‘#1f77b4’}, ‘tickfont’ : {‘color’: ‘#1f77b4’}},
yaxis2={‘title’: ‘Corrente’, ‘overlaying’: ‘y’,‘side’: ‘right’,
‘titlefont’: {‘color’: ‘#ff7f0e’}, ‘tickfont’: {‘color’: ‘#ff7f0e’} },
yaxis3={‘title’: ‘Tensao’, ‘overlaying’: ‘y’,‘side’: ‘right’,
‘titlefont’: {‘color’: ‘#d62728’}, ‘tickfont’: {‘color’: ‘#d62728’}}
)
}
)
Result:
I tried using the example of multiple axes on ploty: https://plot.ly/python/multiple-axes/ but it didn’t help much. Here is the result:
dcc.Graph(id=‘grafico’,
figure={
‘data’: [
{‘x’:df[‘Data’].values, ‘y’:df[‘VA’].values, ‘type’:‘line’, ‘name’:‘Potencia’},
{‘x’:df[‘Data’].values, ‘y’:df[‘I’].values, ‘type’:‘line’, ‘name’:‘Corrente’, ‘yaxis’: ‘y2’},
{‘x’:df[‘Data’].values, ‘y’:df[‘V’].values, ‘type’:‘line’, ‘name’:‘Tensao’, ‘yaxis’: ‘y3’}
],
‘layout’: go.Layout(
title=‘Potencia, Corrente, Tensão’,
yaxis={‘title’: ‘Potencia’, ‘titlefont’ : {‘color’: ‘#1f77b4’}, ‘tickfont’ : {‘color’: ‘#1f77b4’}},
yaxis2={‘title’: ‘Corrente’, ‘overlaying’: ‘y’,‘side’: ‘right’, ‘anchor’: ‘x’,
‘titlefont’: {‘color’: ‘#ff7f0e’}, ‘tickfont’: {‘color’: ‘#ff7f0e’} },
yaxis3={‘title’: ‘Tensao’, ‘overlaying’: ‘y’,‘side’: ‘right’, ‘anchor’: ‘free’, ‘position’: ‘0.85’,
‘titlefont’: {‘color’: ‘#d62728’}, ‘tickfont’: {‘color’: ‘#d62728’}}
)
}
)
Graph:
Any ideas on what I am doing wrong and how to fix this?
Regards,