<html><body><div style="color:#000; background-color:#fff; font-family:Courier New, courier, monaco, monospace, sans-serif;font-size:13px"><div class="" style="">  Hola a todos, </div><div class="" style="">mi problema es sencillo pero no logro dar con el.</div><div class="" style=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class="">Estoy incrustando unos floating.pie en un mapa. Relaciono unas variables (letras) con ciudades. </div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class="">El caso es que no soy capaz de relacionar los colores de la leyenda con las variables, solamente utiliza los primeros colores por orden y yo quiero cada
 variable un  color. Lo puedo hacer "a pedal" pero queria un método mas directo.</div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class="">Adjunto mapa, excel con datos y script el cual tambien pongo aqui</div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class="">saludos</div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;"
 class=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size:
 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class=""><br class="" style=""></div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class="">library(maps)</div><div style="background-color: transparent;" class="">library(mapdata)</div><div style="background-color: transparent;" class="">library(plotrix)</div><div style="background-color: transparent;" class=""># creating metafile</div><div style="background-color: transparent;"
 class="">win.metafile(filename = "C:/RUN//prueba.emf",40,20,pointsize=15)</div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class="">par(mar=c(2,2,2,2) + 0.1)</div><div style="background-color: transparent;" class=""># mapping</div><div style="background-color: transparent;" class="">map(database = "worldHires", xlim = c(-10,4), ylim = c(32,46),type="n")</div><div style="background-color: transparent;" class="">map(database = "worldHires", xlim = c(-10,4), ylim = c(32,46),fill=T,col="darkseagreen",add=T)</div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class="">text(-9.45,42.25,"Vigo",cex=3,font=1)</div><div style="background-color:
 transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class="">text(2.15,41,"Barcelona",cex=3,font=1)</div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class="">text(-5.8,43.8,"Oviedo",cex=3,font=1)</div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class="">text(-4.42,37,"Malaga",cex=3,font=1)</div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;"
 class="">text(-3.68,43,"Santander",cex=3,font=1)</div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class="">prueba<-read.csv("C:/RUN//prueba.csv",sep=";",dec=".")</div><div style="background-color: transparent;" class="">prueba1<-as.matrix(prueba[,-1])</div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class="">cores<-c("darkgreen","yellow","red","brown","orange","pink","green","yellow","lightgreen","blue","pink","lightblue","white","purple")</div><div
 style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""> for (n in 1:nrow(prueba1))</div><div style="background-color: transparent;" class="">{</div><div style="background-color: transparent;" class="">  kk<-as.vector(prueba1[n,])</div><div style="background-color: transparent;" class="">floating.pie(kk[1],kk[2],x=kk[3:18],col=cores,radius=0.35)</div><div style="background-color: transparent;" class="">    }</div><div style="background-color: transparent;" class=""> #leyenda1</div><div style="background-color: transparent;" class="">z<- c("A","B","C","D","E","F","G",</div><div style="background-color: transparent;" class="">"H","I","J","K","L",</div><div style="background-color: transparent;" class="">"M","N","O", "P")</div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;"
 class="">legend(-10,41,z,pch=22,pt.cex=2,pt.bg=cores,title="LETTER",text.width=2,cex=2.5,inset=.03,bg="white")</div><div style="background-color: transparent;" class=""><br class="" style=""></div><div style="background-color: transparent;" class=""># cierra el fichero metafile</div><div style="background-color: transparent;" class="">dev.off()</div><div style="color: rgb(0, 0, 0); font-size: 12.7272720336914px; font-family: 'Courier New', courier, monaco, monospace, sans-serif; font-style: normal; background-color: transparent;" class=""><br class="" style=""></div></div></body></html>