title: Controlling color, legend when plotting from Pandas DataFrame with multiple y values for each x
body: <p>I have a dataframe with 3 columns. I would like to plot col1 on the x axis with col2 and col3 on the y axis. Col1 has repeating values, so for each x value there are duplicate y values.</p>
  
  <p>Example dataframe:</p>
  
  <pre><code>DF = pd.DataFrame({"name": ["Alice", "Alice", "Charles", "Charles", "Kumar", "Kumar"],
                "height": [124, 126, 169, 170, 175, 174],
                "weight": [100, 105, 123, 125, 139, 140]})
  
  DF 
  
      name    height  weight
    0 Alice   124     100
    1 Alice   126     105
    2 Charles 169     123
    3 Charles 170     125
    4 Kumar   175     139
    5 Kumar   174     140
  </code></pre>
  
  <p>I want:</p>
  
  <p>A) each person to occur only once on the x axis</p>
  
  <p>B) keep all heights one color and all weights another color, with an accurate, non-repeating legend</p>
  
  <p>So far I can get either A or B, not both. Below is what I'm trying and the output. For A, this was helpful (<a href="https://stackoverflow.com/questions/34280444/python-scatter-plot-with-multiple-y-values-for-each-x">Python Scatter Plot with Multiple Y values for each X</a>)</p>
  
  <p>For A:</p>
  
  <pre><code>f = DF.groupby("name", as_index=False).agg({"height":lambda x: tuple(x), "weight":lambda x: tuple(x)})
  for x, (y1, y2) in enumerate(zip(f.height.values.tolist(), f.weight.values.tolist()), start=1):
  
      plt.scatter([x] * len(y1), y1, color='green', marker='o', label="height")
      plt.scatter([x] * len(y2), y2, color='blue', marker='o', label="weight")
  
  plt.xticks(np.arange(1, len(f.name.values) +1))
  plt.axes().set_xticklabels(f.name.values.tolist())
  plt.legend(loc="best")
  plt.show()
  </code></pre>
  
  <p>For B:</p>
  
  <pre><code>ax = DF.plot(style="o", figsize=(7, 5), xlim=(-1, 6))
  ax.set_xticks(DF.index)
  ax.set_xticklabels(DF.name, rotation=90)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ibfdt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ibfdt.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/KGuUO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KGuUO.png" alt="enter image description here"></a></p>