# Plot several lines with different starting points on the x-axis

First of all, I would like to apologize in advance if I don't use the correct terms or if I express myself unclear but I just started to work with Mathematica.

I'm simulating electricity prices and therefore created a table which show 10 possible price movements (the rows) over the next 10 days (the columns).

But as I'm only interested in the prices if they once moved over a limit of 1.2 I used the function LengthWhile and then Take and got the following output:

{{1.14213, 1.22155, 1.23436, 1.35038, 1.35104, 1.48351}, {1.0484,
1.42157, 1.57688, 2.07304, 1.61537, 1.326, 1.18823, 1.4154, 1.56133,
1.93402}, {1.06792}, {1.19792, 1.77863, 2.24724, 2.27939, 2.15542,
2.47559}, {1, 1.31003, 1.06341, 1.17975, 0.966335, 0.90843, 0.70606,
0.683366, 0.762621, 0.716291,
0.631823}, {0.428993}, {0.636747}, {1, 1.35605, 1.06939, 1.09904,
1.14575, 1.05545, 1.13386, 0.868574, 0.846754, 0.702533,
0.864972}, {1.08078, 1.29863, 1.17577, 0.995288,
1.05625}, {0.637442}}


If I use ListLinePlot now, all lines are starting at 1 on the x-axis and then ending on different points. But I want them all to end at 10 on the x-axis and therefore starting at different points on the x-axis. Can anybody help me here?

Thanks!

## 1 Answer

Is this what you want?

ls={{1.14213, 1.22155, 1.23436, 1.35038, 1.35104, 1.48351}, {1.0484, 1.42157, 1.57688, 2.07304, 1.61537, 1.326, 1.18823, 1.4154, 1.56133, 1.93402}, {1.06792}, {1.19792, 1.77863, 2.24724, 2.27939, 2.15542, 2.47559}, {1, 1.31003, 1.06341, 1.17975, 0.966335, 0.90843, 0.70606, 0.683366, 0.762621, 0.716291, 0.631823}, {0.428993}, {0.636747}, {1, 1.35605, 1.06939, 1.09904, 1.14575, 1.05545, 1.13386, 0.868574, 0.846754, 0.702533, 0.864972}, {1.08078, 1.29863, 1.17577, 0.995288, 1.05625}, {0.637442}};

ListPlot[PadLeft[#, 10, None] & /@ ls,Joined->True]


• Yes, thank you!
– mary
Apr 19, 2013 at 15:41