1
Comment tracer une ligne verticale en mode déconnecté, en utilisant python? Je veux ajouter des lignes à x = 20, x = 40 et x = 60, le tout dans la même parcelle.Comment tracer des lignes verticales dans l'intrigue hors ligne?
def graph_contracts(self):
trace1 = go.Scatter(
x=np.array(range(len(all_prices))),
y=np.array(all_prices), mode='markers', marker=dict(size=10, color='rgba(152, 0, 0, .8)'))
data = [trace1]
layout = go.Layout(title='Market Contracts by Period',
xaxis=dict(title='Contract #',
titlefont=dict(family='Courier New, monospace', size=18, color='#7f7f7f')),
yaxis=dict(title='Prices ($)',
titlefont=dict(family='Courier New, monospace', size=18, color='#7f7f7f')))
fig = go.Figure(data=data, layout=layout)
py.offline.plot(fig)
a dû changer y1 à 16, mais il fait l'affaire! –
Vous pouvez également utiliser 'yref: 'paper' qui force les coordonnées à être relatives à la grille et non relatives à vos valeurs. –