Es una base de datos que almacena imágenes de siluetas de diferentes organismos. Cada imagen está asociada a uno o más nombres taxonómicos e indica aproximadamente el linaje al que pertenece dicho organismo.
rphylopic, un paquete de R para obtener, transformar y visualizar siluetas de organismos de la base de datos PhyloPic.
rphylopic permite a los usuarios modificar la apariencia de estas siluetas para una personalización máxima al programar visualizaciones de alta calidad en flujos de trabajo de R (base) o (ggplot2)
Nuestro compañero Jose Luis ha contribuido a esta gran base de datos con Siluetas de peces colombianos
Y todos nosotros podemos contribuir libremente a la construcción de esta base de datos
Este encuentro tiene como objetivo que conozcamos la herramienta y algunas de sus aplicaciones.
Necesitamos las librerias:
Aqui vamos a revisar las funciones basicas: rphylopic
Todo lo que vamos a ver esta disponible y resumido en la viñeta de los creadores del paquete: rphylopic viñeta
# Funcion para seleccionar de todas las imagenes la que mas nos guste
pickp<-pick_phylopic(name = "characidae",n=1)[1] "199829d3-183a-4eb3-a35a-a8705d28cb56"
fish <- read.csv("fishdata.csv") #leer datos:
uuid <- get_uuid(name = "Sturisomatichthys aureum")#obtener sid
img <- get_phylopic(uuid = uuid, format = "vector")#obtener silueta
plot1 <- fish %>% filter(Specie == "Sturisomatichthys aureum") %>%
ggplot(aes(x = talla, y = Peso)) +
geom_point(size = 3, alpha = 0.6, color = "#8000FF") +
theme_minimal(base_size = 14) +
labs( title = "Relación entre Talla y Peso",subtitle = "Sturisomatichthys aureum",x = "Talla (cm)", y = "Peso (g)") +
theme(plot.title = element_text(face = "bold", size = 16, hjust = 0.5), plot.subtitle = element_text(size = 12, hjust = 0.5),
axis.title = element_text(face = "bold"),panel.grid.minor = element_blank(), axis.line = element_line(size = 0.5,colour = "black",linetype = 1 )
)
plot1Con la silueta
fish %>%
filter(Specie == "Sturisomatichthys aureum") %>%
ggplot() + geom_phylopic(
img = img,
aes(x = talla, y = Peso, fill = Sexo,size=Peso),
alpha = 0.8, # También el alpha directo
show.legend = TRUE,
color="black",
key_glyph = phylopic_key_glyph(img = img)
) +
theme_minimal(base_size = 16) +
scale_fill_manual(values = c("#8000FF", "black"),label=c("Hembra","Macho")) +
xlim(NA, 18) +
labs(
title = "Relación entre Talla y Peso",
subtitle = "Sturisomatichthys aureum",
x = "Talla (cm)",
y = "Peso (g)"
) +
theme(
plot.title = element_text(face = "bold", size = 16, hjust = 0.5),
plot.subtitle = element_text(size = 12, hjust = 0.5),
axis.title = element_text(face = "bold"),
panel.grid.minor = element_blank(),
axis.line = element_line(size = 0.5, colour = "black", linetype = 1)
)Si queremos usar mas de una imagen
#Obtenemos cada una
uuidstu <- get_uuid(name = "Sturisomatichthys aureum")
imgstu <- get_phylopic(uuid = uuidstu,format ="vector" )
uuidpim <- get_uuid(name = "Pimelodella macrocephala")
imgpim <- get_phylopic(uuid = uuidpim,format ="vector" )
uuidchat <- get_uuid(name = "Chaetostoma")
imgchat<- get_phylopic(uuid = uuidchat,format ="vector" )
uuidas <- get_uuid(name = "Astroblepus trifasciatus")
imgas<- get_phylopic(uuid = uuidas,format ="vector" )plot3 <- fish %>% ggplot(aes(x=Peso, y=Specie,fill = Specie,color=Specie)) +
geom_density_ridges(alpha=0.6)+ labs(
title = "Pesos",
subtitle = "Siluriformes",
x = "Peso (g)",
y = "Especies"
) + scale_fill_manual(values = c("#440154FF","#31688EFF","#35B779FF","#FDE725FF"))+ theme_minimal(base_size = 14) +
theme(
plot.title = element_text(face = "bold", size = 16, hjust = 0.5),
plot.subtitle = element_text(size = 12, hjust = 0.5),
axis.title = element_text(face = "bold"),
panel.grid.minor = element_blank(),
legend.position = "none",
axis.line = element_line(size = 0.5, colour = "black", linetype = 1)
)+ add_phylopic(img=imgstu, x=28, y = 4.2,ysize = 0.5,color = "black",fill = "black" ,alpha=1,
horizontal = FALSE, vertical = FALSE, angle = 0)+
add_phylopic(img=imgpim, x=28, y = 3.2,ysize = 0.5,color = "black",fill = "black",alpha=1,
horizontal = FALSE, vertical = FALSE, angle = 0)+
add_phylopic(img=imgchat, x=28, y = 2.2,ysize = 0.3,color = "black",fill = "black",alpha=1,
horizontal = FALSE, vertical = FALSE, angle = 0)+
add_phylopic(img=imgas, x=28, y = 1.2,ysize = 0.3,color = "black",fill = "black",alpha=1,
horizontal = FALSE, vertical = FALSE, angle = 0)
plot3Cuando no tenemos la filogenia de los grupos podemos recuperar relaciones simples
nametre <- c("Pimelodella macrocephala","Chaetostoma leucomelas","Sturisomatichthys aureum","Astroblepus trifasciatus")
otl_tree<-rotl::tnrs_match_names(nametre) %>%
pull(ott_id) %>% tol_induced_subtree(label_format="name")
Progress [----------------------------------] 0/29 ( 0%) ?s
Progress [================================] 29/29 (100%) 0s
#Muuuy simple
uuid <- get_uuid(name = "Astroblepus trifasciatus")# obtener el identificador unico de la imagen
img <- get_phylopic(uuid = uuid,format ="vector" ) #obtener imagen
img<-recolor_phylopic(img,0.7, "black",fill="black")
save_phylopic(img = img, path = "Astro.png",
width = 500, height = 500)
world <- ne_countries(scale = "medium", returnclass = "sf")
as <- fish %>% filter(Specie == "Astroblepus trifasciatus") %>% mutate(uid=uuidas) %>% mutate(uu=uuid)
ggplot() + geom_sf(data = world) + # Paleta bonita y clara
theme_minimal() +
labs(title = "Mapa de América del Sur") +
xlim(-80, -65) + ylim(-5, 15) + ggimage::geom_image( data=as,image="D:/Curso_phylopic/Astro.png",aes(x = lon, y = lat), size = 0.05, alpha = 0.75)uuid <- get_uuid(name = "Chaetostoma")# obtener el identificador unico de la imagen
img <- get_phylopic(uuid = uuid,format ="vector" ) #obtener imagen
img<-recolor_phylopic(img,0.7, "black",fill="black")
save_phylopic(img = img, path = "Chaeto.png", width = 500, height = 500)
Cet <- fish %>% filter(Specie == "Chaetostoma leucomelas")
greenLeafIcon <- makeIcon(
iconUrl = "D:/Curso_phylopic/Chaeto.png",
iconWidth = 50, iconHeight = 50,
iconAnchorX = 50, iconAnchorY = 50
)
leaflet(data = Cet) %>% addTiles() %>%
addMarkers(~lon, ~lat, icon = greenLeafIcon)

Phylopic y gráficas en R