require(sp) require(maptools) require(maps) #Q1- sup. resposta x <- seq(0, 1.5, length = 30) y <- seq(0, 1.5, length = 30) #z.f<-function(x,y){y<--15 - 1 * x - 0.5 * y + .5*x^2 + .5*y^2 -.3*x*y} z.f<-function(x,y){y<--15 - 1 * x - 0.5 * y} z <- outer(x, y, z.f) persp(x,y,z, theta = -35, phi = 10, expand = 0.5, col = "gray", xlab = "X", ylab = "Y", zlab = "Resposta",scale = T, ticktype = "detailed",xlim=c(0,1.5)) #Q2- curva de nĂ­vel z.f<-function(x,y){y<--15 + 1 * x + 0.5 * y} z <- outer(x, y, z.f) contour(x, y, z, xlab = "X", ylab = "Y") #Q3- bolhas set.seed(123) xc = round(runif(10), 2) yc = round(runif(10), 2) xy = cbind(xc, yc) xy.sp = SpatialPoints(xy) df <- data.frame(z1 = seq(10,50,length=10)) xy.spdf <- SpatialPointsDataFrame(xy.sp, df) print(bubble(xy.spdf, "z1", col="black",fill=FALSE, maxsize=2)) #Q4- maptools map("world","brazil",fill=TRUE,col="gray") #map.axes() box() title("Mapa do Brasil") text(-49,-24.6,"Curitiba",cex=.7) points(-49.16,-25.25,pch=17,cex=1)