setwd("C:/Users/lisa1/Documents/UFPR/Doutorado/Disci_dados_R/")barras<-read.csv("Familias.csv",header =TRUE, sep =",")library(ggplot2)library(jpeg)p2 <-readJPEG("download.jpg")ggplot(barras, aes(x=reorder(Familia, -num_sps), y=num_sps, fill=Riqueza))+geom_bar(width =0.5, stat="identity", position =position_dodge2())+labs(y ="Número de espécies por familia", title ="Número de espécies usadas na restauração da Floresta com Araucária", subtitle ="Comparações por Familia")+scale_y_continuous(expand=c(0,0), limits=c(0,207))+scale_fill_manual(values =c("#6F99ADFF","#20854EFF"), labels =c("Local", "Regional"))+theme_classic()+theme(legend.title =element_blank(),legend.position =c(0.90, 0.9),axis.title.x =element_blank(),axis.text.x =element_text(face="italic", angle=30, hjust=1, color="Black"),plot.title =element_text(colour ="Black", size=15))+annotation_raster(p2, xmin=30, xmax=28, ymin =160, ymax=200)
Gráfico 2. depois da disciplina
dados <-data.frame(numero_estudos =c(78,3,3,5,19),tipo_restauracao =c('Não avaliada','Em perigo','Vulnerável','Quase ameaçada','Pouco preocupante'))head(dados)
numero_estudos tipo_restauracao
1 78 Não avaliada
2 3 Em perigo
3 3 Vulnerável
4 5 Quase ameaçada
5 19 Pouco preocupante
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ lubridate 1.9.2 ✔ tibble 3.2.1
✔ purrr 1.0.1 ✔ tidyr 1.3.0
✔ readr 2.1.4
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggsci)vu<-ggplot(dados, aes(x="", y=tipo_restauracao, fill=tipo_restauracao)) +geom_bar(width =1, stat ="identity") +labs(title ="Status de ameaça das espécies usadas na restauração da Floresta com Araucária")+coord_polar("y", start=0)+scale_fill_viridis_d()+theme_minimal()+theme(axis.title =element_blank(),axis.text.y=element_blank(), legend.title =element_blank(),legend.position="bottom",axis.text.x=element_blank())vu
###O que aprendi? Fazer mapas de distribução de espécies
# Exercício 2-Utilizando os recursos do banco de dados do GBIF e utilizando o pacote rgbif, apresente a localização de alguma espécie que você estude ou goste. Lembre-se que se a distribuição é muito ampla, os dados vão demorar a carregar, então limitar o número de observações ou escolher uma espécie de distribuição restrita pode ser uma opção!library(tidyverse)library(ggmap)
ℹ Google's Terms of Service: <https://mapsplatform.google.com>
ℹ Please cite ggmap if you use it! Use `citation("ggmap")` for details.
library(maps)##tem alguns mapas já previamente feitos
Attaching package: 'maps'
The following object is masked from 'package:purrr':
map
Warning: The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
ℹ Please use the `linewidth` argument instead.
###O que aprendi? Fazer mapas a partir de shapefiles
library(rgdal)
Loading required package: sp
Please note that rgdal will be retired during 2023,
plan transition to sf/stars/terra functions using GDAL and PROJ
at your earliest convenience.
See https://r-spatial.org/r/2022/04/12/evolution.html and https://github.com/r-spatial/evolution
rgdal: version: 1.6-6, (SVN revision 1201)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.6.2, released 2023/01/02
Path to GDAL shared files: C:/Users/lisa1/AppData/Local/R/win-library/4.3/rgdal/gdal
GDAL does not use iconv for recoding strings.
GDAL binary built with GEOS: TRUE
Loaded PROJ runtime: Rel. 9.2.0, March 1st, 2023, [PJ_VERSION: 920]
Path to PROJ shared files: C:/Users/lisa1/AppData/Local/R/win-library/4.3/rgdal/proj
PROJ CDN enabled: FALSE
Linking to sp version:1.6-0
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading sp or rgdal.
library(ggplot2)library(maptools)
Checking rgeos availability: TRUE
Please note that 'maptools' will be retired during 2023,
plan transition at your earliest convenience;
some functionality will be moved to 'sp'.
You have loaded plyr after dplyr - this is likely to cause problems.
If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
library(plyr); library(dplyr)
rgeos version: 0.6-3, (SVN revision 696)
GEOS runtime version: 3.11.2-CAPI-1.17.2
Please note that rgeos will be retired during October 2023,
plan transition to sf or terra functions using GEOS at your earliest convenience.
See https://r-spatial.org/r/2023/05/15/evolution4.html for details.
GEOS using OverlayNG
Linking to sp version: 1.6-0
Polygon checking: TRUE