title: How to change Lattice graphics default groups colors?
body: <p>When using <code>groups</code>, Lattice gives each group a different color.  Example:</p>
  
  <pre><code>df &lt;- data.frame(x=1:56, y=rnorm(56), class=1:14) # create some data
  xyplot(y ~ x, groups=class, data=df, type="l", auto.key=list(space="right"))
  </code></pre>
  
  <p>However, by default Lattice only uses seven colors, as running the example above will show.  If you have more than seven groups, Lattice cycles through the colors again in order, causing data from distinct groups to have the same color.  I learned from another Stackoverflow article that these colors are stored in <code>trellis.par.get()$superpose.symbol$col</code>.  I want to make the list of groups colors longer (without having to specify colors explicitly in plotting calls).  I can't figure out how to change this list of colors, however.  (This might be due to ignorance about some basic facts about Lattice syntax or semantics.)  This illustrates the problem:</p>
  
  <pre><code>&gt; trellis.par.get()$superpose.symbol$col
  [1] "#0080ff"   "#ff00ff"   "darkgreen" "#ff0000"   "orange"    "#00ff00"   "brown"    
  &gt; class(trellis.par.get()$superpose.symbol$col)
  [1] "character"
  &gt; mycolors &lt;- c(trellis.par.get()$superpose.symbol$col, "navyblue", "purple", "gold")
  &gt; trellis.par.get()$superpose.symbol$col[1:10] &lt;- mycolors
  Error in trellis.par.get()$superpose.symbol$col[1:10] &lt;- mycolors : 
    invalid (NULL) left side of assignment
  </code></pre>
  
  <p>I don't understand what that error message is telling me. </p>