title: Variable width column chart with cumsum function in R
body: <p>I am trying to make a variable width column chart with 4 non overlapping columns each representing a step.</p>
  <p>the width of each column: width = c(25,50,75,100)
  height = c(10,20,40,30)</p>
  <p>This is the code I have found which works great as long as the width values are positive:</p>
  <p>End point of each column: df$w &lt;- cumsum(df$width)  resulting in (25,75,150, 250)</p>
  <p>Start point of each column: df$wm &lt;- df$w - df$width  resulting in (0,25,75,150)</p>
  <p>If I have a negative number for the width of the first column (-25,50,75,100) then the above cumsum code for the end point of the columns (w) results in (-25,25,100,200 ) and the starting point gives (0, -25,25,100). This means my columns overlap.  And i don't want any overlap so I would like to amend the above code to result in the following:  endpoint w=(-25,50, 125, 225) and starting point (0,0,50,125).</p>
  <p>Could somebody please help me?</p>