Skip to content

Commit

Permalink
Adicionei práticas
Browse files Browse the repository at this point in the history
  • Loading branch information
marmello77 committed May 3, 2022
1 parent 8e03c8d commit a89c59f
Show file tree
Hide file tree
Showing 10 changed files with 1,273 additions and 0 deletions.
42 changes: 42 additions & 0 deletions PC3 Socialidade/socialidade.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: "Prática de Computador III: Socialidade"
output: pdf_document
author: "Marco A. R. Mello"
editor_options:
markdown:
wrap: 72
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::knit_hooks$set(inline = function(x) {
prettyNum(x, big.mark=",")
})
```

Universidade de São Paulo

Instituto de Biociências

Departamento de Ecologia

[Tópicos Avançados em Ecologia de Animais
(BIE0315)](https://uspdigital.usp.br/jupiterweb/obterDisciplina?sgldis=BIE0315&verdis=4)

Profs. José Carlos Motta Jr. & Marco A. R. Mello

Artigo de base: [Guimarães Jr. et al. (2007, Physical Review E)](https://doi.org/10.1103/PhysRevE.76.042901)

Agradecimentos: O primeiro autor do artigo de base tirou nossas dúvidas sobre os resultados de seu trabalho.

[README](https://github.com/marmello77/EcoAnimal#readme)


## Instruções

Nesta prática, usaremos a solução apresentada no roteiro: fazer as simulações diretamente na plataforma online NetLogo Web. Siga as instruções dadas no roteiro.


## Para saber mais

[O modelo SIR e o achatamento da curva](https://biologiadeprogramas.wordpress.com/2020/03/22/o-modelo-sir-e-o-achatamento-da-curva/)
Binary file added PC3 Socialidade/socialidade.pdf
Binary file not shown.
Binary file added PC4 Movimentos/figuras/mapa1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PC4 Movimentos/figuras/mapa2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PC4 Movimentos/figuras/mapa3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PC4 Movimentos/figuras/mapa4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
174 changes: 174 additions & 0 deletions PC4 Movimentos/movimentos.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
################################################################################
# Universidade de São Paulo
# Instituto de Biociências
# Departamento de Ecologia
# Topicos Avançados em Ecologia de Animais (BIE0315)
# Profs. José Carlos Motta Jr. & Marco A. R. Mello
# Prática de Computador IV: Movimentos
# README: https://github.com/marmello77/EcoAnimal#readme
################################################################################

setwd(dirname(rstudioapi::getActiveDocumentContext()$path))

rm(list= ls())

cat("\014")

library(ggplot2)
library(ggmap)
library(ggsn)
library(maps)
library(mapdata)
library(ggrepel)

pontos = read.csv("pc4 dados.csv", header = T)

head(pontos)

colnames(pontos) = c("individuo", "lat", "long", "data",
"datajul", "hora", "posicao")
head(pontos)

pontos$individuo = as.factor(pontos$individuo)
class(pontos$individuo)

area <-map_data("world", region="Brazil", zoom=5)

head(area)

min(pontos$long)
max(pontos$long)
min(pontos$lat)
max(pontos$lat)

longs<-c(min(pontos$long)-0.01, max(pontos$long)+0.01)
lats<-c(min(pontos$lat)-0.01, max(pontos$lat)+0.01)

plot(pontos$lat~pontos$long)


################################# MAPA 1 #######################################


g1 <- ggplot() + geom_polygon(data = area,
aes(x=long, y = lat, group = group),
fill = "lightgrey", color = "lightgrey") +
coord_fixed(1.1) +
geom_polygon(data = area,
aes(x = long, y = lat, group = group),
color = "white", fill = NA, size = 0.04) +
geom_point(data = pontos, aes(x = long, y = lat),
color = "red",
size = 2,
alpha = 0.6) +
ggtitle("Localizações dos morcegos") +
labs(x = "Longitude",
y = "Latitude") +
theme(text = element_text(size=14), #Ajuste os tamanhos das fontes
plot.title = element_text(size=20, hjust=0.5),
axis.text.x = element_text(size = 10, angle=0, hjust=1),
axis.text.y = element_text(size = 10, angle=0, vjust=1),
axis.title.x = element_text(size = 12, angle=0),
axis.title.y = element_text(size = 12, angle=90))

png(filename= "figuras/mapa1.png", res= 300, height= 1500, width= 3000)
plot(g1)
dev.off()


################################# MAPA 2 #######################################


g2 <- ggplot() + geom_polygon(data = area,
aes(x=long, y = lat, group = group),
fill = "lightgrey", color = "lightgrey") +
xlim(longs) +
ylim(lats) +
coord_fixed(1.1) +
geom_polygon(data = area,
aes(x = long, y = lat, group = group),
color = "white", fill = NA, size = 0.04) +
geom_point(data = pontos, aes(x = long, y = lat),
color = "red",
size = 2,
alpha = 0.6) +
ggtitle("Localizações dos morcegos") +
labs(x="Longitude", y = "Latitude") +
theme(text = element_text(size=14), #Ajuste os tamanhos das fontes
plot.title = element_text(size=20, hjust=0.5),
axis.text.x = element_text(size = 10, angle=0, hjust=1),
axis.text.y = element_text(size = 10, angle=0, vjust=1),
axis.title.x = element_text(size = 12, angle=0),
axis.title.y = element_text(size = 12, angle=90))

png(filename= "figuras/todos_escala.png", res= 300, height= 1500, width= 3000)
plot(g2)
dev.off()


################################# MAPA 3 #######################################


g3 <- ggplot() + geom_polygon(data = area,
aes(x=long, y = lat, group = group),
fill = "lightgrey", color = "lightgrey") +
xlim(longs) +
ylim(lats) +
coord_fixed(1.1) +
geom_polygon(data = area,
aes(x = long, y = lat, group = group),
color = "white", fill = NA, size = 0.04) +
geom_point(data = pontos, aes(x = long, y = lat, color = individuo),
size = 2,
alpha = 0.6) +
ggtitle("Localizações dos morcegos") +
labs(x = "Longitude",
y = "Latitude",
color = "Indivíduo") +
theme(text = element_text(size=14), #Ajuste os tamanhos das fontes
plot.title = element_text(size=20, hjust=0.5),
axis.text.x = element_text(size = 10, angle=0, hjust=1),
axis.text.y = element_text(size = 10, angle=0, vjust=1),
axis.title.x = element_text(size = 12, angle=0),
axis.title.y = element_text(size = 12, angle=90))

png(filename= "figuras/individuos_escala.png", res= 300,
height= 1500, width= 3000)
plot(g3)
dev.off()


################################# MAPA 4 #######################################


area_de_estudo = get_map(c(left = longs[1], bottom = lats[1],
right = longs[2], top = lats[2]),
maptype = "satellite")
ggmap(area_de_estudo)

g4 <- ggmap(area_de_estudo) + geom_polygon(data = area,
aes(x=long, y = lat, group = group),
fill = "lightgrey",
color = "lightgrey") +
coord_fixed(1.1) +
geom_polygon(data = area,
aes(x = long, y = lat, group = group),
color = "white", fill = NA, size = 0.04) +
geom_point(data = pontos, aes(x = long, y = lat, color = individuo),
size = 2,
alpha = 0.6) +
ggtitle("Localizações dos morcegos") +
labs(x = "Longitude",
y = "Latitude",
color = "Indivíduo") +
theme(text = element_text(size=14), #Ajuste os tamanhos das fontes
plot.title = element_text(size=20, hjust=0.5),
axis.text.x = element_text(size = 10, angle=0, hjust=1),
axis.text.y = element_text(size = 10, angle=0, vjust=1),
axis.title.x = element_text(size = 12, angle=0),
axis.title.y = element_text(size = 12, angle=90))

png(filename= "figuras/individuos_paisagem.png", res= 300,
height= 1500, width= 3000)
plot(g4)
dev.off()
Loading

0 comments on commit a89c59f

Please sign in to comment.