Scatter 'hv' shape variation

The documentation explains how to use different line shapes/interpolation in scatter plots.

Is it possible to achieve the β€˜hv’ shape without the β€˜v’ per se.

I am looking just to complete a forward fill horizontal line from each point until the next. Essentially not drawing a complete consecutive line, but instead a series of horizontal lines.

I’m sure this could be completed with drawing multiple traces of individual horizontal lines however i cant believe this would be the most performant way to achieve the desired result. Any help will be appreciated thank you.

+1

I’m interested to use this feature too.

Hi,

would this be a valid solution?

import plotly.graph_objects as go
import random


x = list(range(0,99,1))
y = [random.randint(1, 100) for _ in range(100)]

x_modified = []
y_modified = []
for i in range(len(x) - 1):
    x_modified.extend([x[i], x[i+1], None]) 
    y_modified.extend([y[i], y[i], None])



fig = go.Figure(go.Scatter(
    x=x_modified,
    y=y_modified,
    mode='lines',
    line={
        "shape" : 'linear'
    }
))

fig.show()