title: How to merge colour and shape?
body: <p>My troubles started when I had a variable with more than 6 values because that is the current maximum value for the scale_shape function in ggplot2.</p>
  
  <p>Due to that problem I tried a work-around with another variable that I just wrapped around the length of the original variable.</p>
  
  <p>Here is my example code:</p>
  
  <pre><code>dataf &lt;- structure(list(Municipality = structure(c(2L, 4L, 10L, 11L, 6L, 8L, 3L, 1L, 5L, 9L, 7L), .Label = c("Boyuibe", "Cabezas", "Camiri", "Charagua", "Cuevo", "Gutierrez", "Huacaya", "Lagunillas", "Machareti", "Vallegrande", "Villa Vaca Guzman"), class = "factor"), Growth = c(3.05, 2.85, 0.14, 1.21, 1.59, 2.35, -0.41, 0.81, 0.9, 2.89, 1.8), Density = c(3.0390920594, 0.260984024187, 5.20069847261, 2.50828556783, 3.43964629267, 3.69768961375, 32.4496626479, 2.06145019368, 4.2139578988, 0.740736713557, 1.67034079825)), .Names = c("Municipality", "Growth", "Density"), class = "data.frame", row.names = c(NA, -11L))
  
  dataf &lt;- dataf[with(dataf, order(Municipality)), ]
  # create a new column with values 1 to 6 and same length as Municipality
  modulus &lt;- function(x) (x - 1) %% 6 + 1
  indeces &lt;- 1:length(dataf$Municipality)
  dim(indeces) &lt;- length(dataf$Municipality)
  dataf$Shape &lt;- apply(indeces, 1, modulus)
  dataf$Shape &lt;- factor(dataf$Shape, levels=unique(dataf$Shape))
  plot1 &lt;- ggplot(dataf, aes(x=Density, y=Growth, colour=Municipality,
          shape=Shape))
  plot1 &lt;- plot1 + geom_point(size=3)
  plot1 &lt;- plot1 + scale_x_continuous(expression(paste(
          "Population Density [people per km"^2, "]", sep="")))
  plot1 &lt;- plot1 + scale_y_continuous("Growth Rate [ratio population 2001 /
          population 1992]")
  plot1 &lt;- plot1 + scale_colour("Municipality")
  plot1
  </code></pre>
  
  <p>that produces the following output:
  <img src="https://i.stack.imgur.com/7mTGn.jpg" alt="enter image description here"></p>
  
  <p>I would like the legend to be just like the points in the plot. Is that possible, or is there a smart solution to my first problem with the list of municipalities being too long?</p>
  
  <p>Thanks in advance.</p>