<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.5512" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial color=#0000ff>Estava tentando rodar este código, e vi que 
falta este 
arquivoc:/users/Julianna/Documents/SecSaude/saudemapa.shp</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff>Daria para enviar?.</FONT></DIV>
<BLOCKQUOTE 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial"> </DIV>
  <DIV>Mensagem abaixo em nome da Julianna... (dados disponiveis via 
  datafilehost) </DIV>
  <DIV><BR></DIV>
  <DIV>====</DIV>
  <DIV><BR></DIV>
  <DIV>
  <DIV>E quando fui conferir os breaks, os intervalos estavam certos,mas o mapa 
  resultante estava errado.</DIV>
  <DIV>Porque quando eu não importo o csv e uso o dataframe resultante da 
  função, os breaks ficam ok(da maneira que eu especifico em FixedBreaks) e, do 
  contrario, não???</DIV>
  <DIV><BR></DIV>
  <DIV>segue o código:</DIV>
  <DIV><BR></DIV>
  <DIV>#######################################################</DIV>
  <DIV># CONSTRUINDO MAPAS</DIV>
  <DIV>#######################################################</DIV>
  <DIV>##Code (Comments are preceded by ##)</DIV>
  <DIV>## Load required packages</DIV>
  <DIV><BR></DIV>
  <DIV># Limpando memoria.</DIV>
  <DIV>rm(list=ls(all=TRUE))</DIV>
  <DIV><BR></DIV>
  <DIV>library(maps)</DIV>
  <DIV>library(sp)</DIV>
  <DIV>library(maptools)         </DIV>
  <DIV>library(spdep)      </DIV>
  <DIV>library(classInt)    </DIV>
  <DIV>library(RColorBrewer) </DIV>
  <DIV>library(shape)</DIV>
  <DIV>library(SDMTools)</DIV>
  <DIV>library(latticeExtra)</DIV>
  <DIV>library(ReadImages)</DIV>
  <DIV>library(png)</DIV>
  <DIV><BR></DIV>
  <DIV>rosa_dos_ventos = function(loc=c(-34.5, -8), size = 0.15, bearing=0, 
  cols=1, cex=0.6,...)</DIV>
  <DIV>{</DIV>
  <DIV>  cols <- rep(c("white","black"),8)</DIV>
  <DIV>  radii <- rep(size/c(1,4,2,4),4)</DIV>
  <DIV>  x <- radii[(0:15)+1]*cos((0:15)*pi/8+bearing)+loc[1]</DIV>
  <DIV>  y <- radii[(0:15)+1]*sin((0:15)*pi/8+bearing)+loc[2]</DIV>
  <DIV>  for (i in 1:15)</DIV>
  <DIV>  {</DIV>
  <DIV>    x1 <- c(x[i],x[i+1],loc[1])</DIV>
  <DIV>    y1 <- c(y[i],y[i+1],loc[2])</DIV>
  <DIV>    polygon(x1,y1,col=cols[i])</DIV>
  <DIV>  }</DIV>
  <DIV>  
  polygon(c(x[16],x[1],loc[1]),c(y[16],y[1],loc[2]),col=cols[16])</DIV>
  <DIV>  b <- c("O","S","L","N")</DIV>
  <DIV>  for (i in 0:3) 
  text((size+par("cxy")[1]-0.40)*cos(bearing+i*pi/2)+loc[1],</DIV>
  <DIV>                    
    
  (size+par("cxy")[2]-0.42)*sin(bearing+i*pi/2)+loc[2],b[i+1],cex=cex)</DIV>
  <DIV>}</DIV>
  <DIV><BR></DIV>
  <DIV>## Lendo dados</DIV>
  <DIV>## <A 
  href="http://www.datafilehost.com/download-e5cb7e86.html">http://www.datafilehost.com/download-e5cb7e86.html</A></DIV>
  <DIV>dados = read.table("dadosJulianna.csv", sep = ",", header = TRUE)</DIV>
  <DIV><BR></DIV>
  <DIV># Lendo mapa.</DIV>
  <DIV>mapa = 
  readShapePoly("c:/users/Julianna/Documents/SecSaude/saudemapa.shp")</DIV>
  <DIV>proj4string(mapa) <- CRS("+init=epsg:4291")</DIV>
  <DIV>scaleXY(mapa, 1836656)</DIV>
  <DIV><BR></DIV>
  <DIV><BR></DIV>
  <DIV># arquivo png</DIV>
  <DIV>#img <- readPNG("c:/users/Julianna/Documents/SecSaude/logo_pb.png") # 
  seu arquivo png aqui</DIV>
  <DIV>#set.seed(123)</DIV>
  <DIV>#par(xpd = TRUE)</DIV>
  <DIV><BR></DIV>
  <DIV><BR></DIV>
  <DIV>colors <- brewer.pal(7, "Reds")</DIV>
  <DIV>brks <- classIntervals(dados$ano_2006, n = 7,style="fixed", 
  intervalClosure="right",</DIV>
  <DIV>                    
     fixedBreaks=c(-2, -0.5, 0, 20, 40, 60, 80, 10000), 
  main="Fixed")</DIV>
  <DIV>brks<- brks$brks</DIV>
  <DIV><BR></DIV>
  <DIV>ID = 
  match(substr(mapa$CODIGO,1,6),dados$t_indicadores_municipio.f_municipio)</DIV>
  <DIV>dados = dados[ID,]</DIV>
  <DIV><BR></DIV>
  <DIV>png(filename="c:/mif2006.png", height=750, width=1500)</DIV>
  <DIV><BR></DIV>
  <DIV><BR></DIV>
  <DIV>plot(mapa, col = colors[findInterval(dados$ano_2006, 
  brks,all.inside=TRUE)], axes = TRUE, cex = 1.5, mar=5)</DIV>
  <DIV>##, xlim=c(-39.7, -34.7), ylim=c(-8.5, -6)</DIV>
  <DIV><BR></DIV>
  <DIV>##invisible(text(getSpPPolygonsLabptSlots(mapa), 
  labels=as.character(mapa$NOMEMUN_1), cex=0.65))</DIV>
  <DIV><BR></DIV>
  <DIV>title(main = "PORCENTAGEM DE Ã BITOS INVESTIGADOS\ntipo: mulheres em 
  idade fértil",</DIV>
  <DIV>      font.main = 2, cex.main = 1.8)</DIV>
  <DIV><BR></DIV>
  <DIV>text(-35.7, -6.2, "ANO: 2006", cex = 1.8)</DIV>
  <DIV><BR></DIV>
  <DIV>legend(-39.6,-7.6, c("Sem informação", "0", "]0,20]", "]20,40]", 
  "]40,60]", "]60,80]","Acima de 80"),</DIV>
  <DIV>       fill = colors, bty="n", x.intersp = 1.1, 
  y.intersp = 1.1, cex = 1.6)</DIV>
  <DIV><BR></DIV>
  <DIV>rosa_dos_ventos(loc=c(-34.5,-8),size=0.17,cex=1.20, bearing=0, 
  cols=1)</DIV>
  <DIV><BR></DIV>
  <DIV>SpatialPolygonsRescale(layout.scale.bar(), offset = c(-35,-8.30),</DIV>
  <DIV>                    
     scale = 1, fill = c("transparent", "black"),</DIV>
  <DIV>                    
     plot.grid= FALSE)</DIV>
  <DIV><BR></DIV>
  <DIV>text(-34.5, -8.35, "110.3 KM", cex= 1.3)</DIV>
  <DIV><BR></DIV>
  <DIV>#rasterImage(img, xleft = -39.5, ybottom = -6.25, xright = -38.9 , ytop = 
  -6)</DIV>
  <DIV><BR></DIV>
  <DIV>dev.off()</DIV>
  <DIV><BR></DIV></DIV>
  <P>
  <P><FONT face=Arial size=2></FONT></P></BLOCKQUOTE></BODY></HTML>