title: Use curved lines in bumps chart
body: <p>I'm trying to make a bumps chart (like <a href="https://en.wikipedia.org/wiki/Parallel_coordinates" rel="nofollow noreferrer">parallel coordinates</a> but with an ordinal x-axis) to show ranking over time. I can make a straight-line chart very easily:</p>
  
  
  
  <pre class="lang-r prettyprint-override"><code>library(ggplot2)
  set.seed(47)
  
  df &lt;- as.data.frame(as.table(replicate(8, sample(4))), responseName = 'rank')
  df$Var2 &lt;- as.integer(df$Var2)
  
  head(df)
  #&gt;   Var1 Var2 rank
  #&gt; 1    A    1    4
  #&gt; 2    B    1    2
  #&gt; 3    C    1    3
  #&gt; 4    D    1    1
  #&gt; 5    A    2    3
  #&gt; 6    B    2    4
  
  ggplot(df, aes(Var2, rank, color = Var1)) + geom_line() + geom_point()
  </code></pre>
  
  <p><img src="https://i.imgur.com/G4idXki.png" alt=""></p>
  
  <p>Wonderful. Now, though, I want to make the connecting lines curved. Despite never having more than one y per x, <code>geom_smooth</code> offers some possibilities. <code>loess</code> seems like it should work, as it can ignore points except the closest. However, even with tweaking the best I can get still misses lots of points and overshoots others where it should be flat:</p>
  
  <pre class="lang-r prettyprint-override"><code>ggplot(df, aes(Var2, rank, color = Var1)) + 
      geom_smooth(method = 'loess', span = .7, se = FALSE) + 
      geom_point()
  </code></pre>
  
  <p><img src="https://i.imgur.com/4KOE0zb.png" alt=""></p>
  
  <p>I've tried a number of other splines, like <code>ggalt::geom_xspline</code>, but they all still overshoot or miss the points:</p>
  
  <pre class="lang-r prettyprint-override"><code>ggplot(df, aes(Var2, rank, color = Var1)) + ggalt::geom_xspline() + geom_point()
  </code></pre>
  
  <p><img src="https://i.imgur.com/9k74aG5.png" alt=""></p>
  
  <p>Is there an easy way to curve these lines? Do I need to build my own sigmoidal spline? To clarify, I'm looking for something like <a href="https://github.com/d3/d3-shape/blob/master/README.md#curveMonotoneX" rel="nofollow noreferrer">D3.js's <code>d3.curveMonotoneX</code></a> which hits every point and whose local maxima and minima do not exceed the y values:</p>
  
  <p><img src="https://raw.githubusercontent.com/d3/d3-shape/master/img/monotoneX.png" alt="d3.curveMonotoneX image"></p>
  
  <p>Ideally it would probably have a slope of 0 at each point, too, but that's not absolutely necessary.</p>