How to set spacing between lines after creation of LineCollection

Hi everyone, I have a bunch of identical line segments that I created in the LineCollection class. I tried calling the LineCollection.set_offsets() to set spacing between the lines along the y-axis in a line graph, but I still see no results. I wonder if it’s a bug. I want to set the line’s offsets after they are created.

Am I doing this correctly or is there a better alternative?

import matplotlib.pyplot as plt
import matplotlib.collections as mcoll
import numpy as np

x = np.arange(10)
y = np.sin(x) 

# Create a list of line segments
segments = [np.column_stack([x, y])]
segments.append(np.column_stack([x, y]))

# Create the LineCollection
line_collection = mcoll.LineCollection(segments)

fig, ax = plt.subplots()
ax.add_collection(line_collection)
ax.autoscale()

line_collection.set_offsets((0,1)) # no visible results

plt.draw()
plt.show()

image

Thank you