title: Plotting points with color and shape based on data variables
body: <p>I am trying to make a scatter plot with the colors of each point corresponding to one variable and the shape of each point corresponding to another variable.
  Here is some example data and the code I used to make the second plot:</p>
  <pre><code>Example data:(of 3 points)
   X    Y    att1    att2
  
  .5    .5    1       A
  .24   .8    3       B
  .6    .7    5       C
  
  code:(for image2)
  &gt; plot(X,Y, col=statc[att2], pch = 15)
  &gt; legend(&quot;right&quot;, statv, fill=statc)
  
  Where:
  &gt; statv
  [1] &quot;A&quot;  &quot;B&quot; &quot;C&quot;  
  &gt; statc
  [1] &quot;red&quot;    &quot;blue&quot;   &quot;orange&quot;
  </code></pre>
  <p>I have done this individually but dont know how to do both. Here is two plots:</p>
  <h1>1<a href="https://i.stack.imgur.com/8RcuY.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/8RcuY.jpg" alt="enter image description here" /></a></h1>
  <h1>2<a href="https://i.stack.imgur.com/8Wz2s.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/8Wz2s.jpg" alt="enter image description here" /></a></h1>
  <p>For example: I want the colors to apply to the points with the same att1 and the shapes to apply to points with the same att2</p>