title: Scatterplot with color groups - base R plot
body: <p>I have a simple scatter plot</p>
  
  <pre><code>x&lt;-rnorm(100)
  y&lt;-rnorm(100)
  z&lt;-rnorm(100)
  </code></pre>
  
  <p>I want to plot the <code>plot(x,y)</code> but the color of the points should be color coded based on <code>z</code>. </p>
  
  <p>Also, I would like to have the ability to define how many groups (and thus colours) <code>z</code> should have. And that this grouping should be resistant to outliers (maybe split the <code>z</code> density into <code>n</code> equal density groups).</p>
  
  <p>Till now I do this manually, is there any way to do this automatically?</p>
  
  <p><strong>Note:</strong> I want to do this with base R not with <code>ggplot</code>.</p>