Slope charts in plotly

Has anyone come up with a slope chart? Yes, I understand it is just a special line scatter with two points, but I’m referring more to the clean look with a tick marker on each side…like below

1 Like

Hi @mbkupfer, here is an example below to get you started. It uses the text attribute of go.Scatter and the possibility to control text position with textposition. Vertical lines are shapes, but you could also use just the y axis for this. To customize and tune the aspect of your plot, you can read the tutorials on

import plotly.graph_objects as go
fig = go.Figure(go.Scatter(x=[0, 1], y=[10, 6], mode='lines+markers+text', 
                           text=['start', 'end'], textposition=['middle left', 'middle right']))
fig.add_shape(type='line', x0=0, x1=0, y0=0, y1=1, xref='x', yref='paper')
fig.add_shape(type='line', x0=1, x1=1, y0=0, y1=1, xref='x', yref='paper')

Ooh very clever! Thanks @Emmanuelle for the elegant solution :smiley: