title: How to plot data per hour, grouped by days?
body: <p>Background: from a large <code>DataFrame</code> I filtered out entries for <code>year=2013</code>, <code>month=June</code>, week of the 3rd - 9th (Monday to Sunday). Then, I grouped the data by <code>day</code>, <code>hour</code>, and <code>user_type</code>, and pivoted the table to get a <code>DataFrame</code> which looks like:</p>
  
  <pre><code>   Day  Hour  Casual  Registered  Casual_percentage
  0  3    0     14      19          42.42
  1  3    1     8       8           50.00
  2  3    2     1       3           25.00
  3  3    3     2       1           66.67
  4  3    4     1       3           25.00
  5  3    5     1       17          5.56
  .  .    .     .       .           .
  </code></pre>
  
  <p>For each day I have 24 hours so for day 4 (Tuesday), the data starts like:</p>
  
  <pre><code>.  .    .     .       .           .  
  21 3    21    32      88          26.67
  22 3    22    26      64          28.89
  23 3    23    23      30          43.40
  24 4    0     10      11          47.62
  25 4    1     1       5           16.67
  26 4    2     1       1           50.00
  .  .    .     .       .           .
  </code></pre>
  
  <p>How can I plot <code>Casual</code> and <code>Registered</code> variables per <code>Hour</code>, for each of the 7 <code>Day</code>s? Would I need to create 7 different plots and align them in 1 figure?</p>
  
  <p>Current code. I feel I'm way off. I also tried to create a <a href="https://matplotlib.org/examples/pylab_examples/multiple_yaxis_with_spines.html" rel="nofollow noreferrer">second x-axis</a> (for <code>Days</code>) using the <a href="https://matplotlib.org/gallery/api/two_scales.html" rel="nofollow noreferrer">documentation</a>.</p>
  
  <pre class="lang-py prettyprint-override"><code>def make_patch_spines_invisible(ax):
      ax.set_frame_on(True)
      ax.patch.set_visible(False)
      for sp in ax.spines.values():
          sp.set_visible(False)
  
  fig, ax1 = plt.subplots(figsize=(10, 5))
  ax1.set(xlabel='Hours', ylabel='Total # of trips started')
  
  ax1.plot(data.Hour, data.Casual, color='g')
  ax1.plot(data.Hour, data.Registered, color='b')
  
  
  """This part is trying to create the 2nd x-axis (Days)"""
  ax2 = ax1.twinx()
  #offset the bottom spine
  ax2.spines['bottom'].set_position(('axes', -.5))
  make_patch_spines_invisible(ax2)
  #show bottomm spine
  ax2.spines['bottom'].set_visible(True)
  ax2.set_xlabel("Days")
  
  
  plt.show()
  </code></pre>
  
  <p>Output:
  <a href="https://i.stack.imgur.com/KsiK6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KsiK6.png" alt="enter image description here"></a></p>
  
  <p><a href="https://imgur.com/a/qi2rjln" rel="nofollow noreferrer">End goal</a></p>