title: How do I plot species as different colours in a point pattern (ppp) using spatstat in R?
body: <p>The set up is this: There are 10 trees within a 20 by 20 m quadrat in a forest. For each tree we know the species, the diameter (in cm), and the location within the quadrat using x,y coordinates.</p>
  <h3>I would like to plot the trees within the quadrat, where the size of the points are to scale, and each species is represented by a different colour circle.</h3>
  <p>Use this data for an example:</p>
  <pre><code>tag &lt;- as.character(c(1,2,3,4,5,6,7,8,9,10))
  
  species &lt;- c(&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,&quot;A&quot;,&quot;B&quot;,&quot;B&quot;,&quot;B&quot;,&quot;C&quot;,&quot;C&quot;,&quot;D&quot;)
  
  diameter &lt;- c(50,20,55,30,30,45,15,20,35,45)
  
  x &lt;- c(9,4,5,14,8,19,9,12,10,2)
  
  y &lt;- c(6,7,15,16,12,4,19,2,14,9)
  
  df &lt;- data.frame(tag, species, diameter, x, y)
  </code></pre>
  <p>First I create the point pattern</p>
  <pre><code>species_map &lt;- ppp(df$x, df$y, c(0,20), c(0,20))
  </code></pre>
  <p>Then I mark the species and diameter</p>
  <pre><code>marks(species_map) &lt;- data.frame(m1 = df$species, m2=(df$diameter))
  </code></pre>
  <p>Now I can plot the point pattern and each point is to scale thanks to the marks on the diameter.
  The &quot;markscale&quot; bit is set to 0.01 because the diamter measurements are in cm and the quadrat size is defined in meters.</p>
  <pre><code>plot(species_map, which.marks=2, markscale=.01)
  </code></pre>
  <p>Now I want to make the circles of different species different colours, but this is where I'm stuck.</p>
  <p>If I try to make a plot that includes both of my marks I just get 2 separate plots, with one using different size points to represent diameter (correctly) and one using different characters to represent different species.</p>
  <pre><code>plot(species_map, which.marks= c(1,2), markscale=.01)
  </code></pre>
  <p>How can I get this plot to represent different species using different colors of the same character while ALSO plotting the points to scale?</p>
  <p>And how can I make it produce 1 single plot?</p>
  <p>Thank you in advance.</p>
  <p>Jay</p>