title: Color scatter plot by time-grouped values
body: <p>I have a DataFrame <code>dfp</code> with columns including <code>saledate</code> (in DateTime), <code>days_to_sell</code> (as an <code>int</code>), and <code>price</code> (as an <code>int</code>). Using the following code,</p>
  
  <pre><code>import pandas as pd
  dfp_week = dfp.groupby(pd.TimeGrouper(key='saledate', freq='W')).mean()
  
  fig, ax = plt.subplots()
  
  ax.scatter(dfp['saledate'].values, dfp['price']/1000.0, c=dfp['days_to_sell'].values)
  
  ax.plot_date(dfp_week.index, dfp_week['price']/1000.0, 'r-')
  xmin,xmax=plt.xlim()
  plt.xlim([datetime.datetime(2015,1,1), xmax])
  
  ax.set_xlabel('Date of sale')
  ax.set_ylabel('Most recent asking price (1,000 euros)')
  plt.title('Property sales in Amsterdam')
  fig.autofmt_xdate()
  </code></pre>
  
  <p>I generate the following plot:</p>
  
  <p><a href="https://i.stack.imgur.com/AQHuK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AQHuK.png" alt="enter image description here"></a></p>
  
  <p>The points are colored by <code>days_to_sell</code>, but there are so many points one cannot see the trend in the data. On the other hand, if I plot <code>days_to_sell</code> itself together with its per-week average,</p>
  
  <pre><code>fig2, ax2 = plt.subplots()
  plt.plot(dfp['saledate'],dfp['days_to_sell'].values,'.')
  plt.plot_date(dfp_week.index, dfp_week['days_to_sell'].values,'r-')
  plt.xlabel('Date of sale')
  plt.ylabel('Days on the market')
  plt.title('Time to sell')
  plt.ylim([0,300])
  fig2.autofmt_xdate()
  </code></pre>
  
  <p>I get</p>
  
  <p><a href="https://i.stack.imgur.com/nAXvN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nAXvN.png" alt="enter image description here"></a></p>
  
  <p>which shows a clear recent 'heating up' of the property market. I'd like to color all the points in the plot by the weekly average of <code>time_to_sell</code>, rather than by the individual values. How can I do this?</p>