# single image
plot(1, 1, type="n", main="A cat")
add_phylopic_base(name = "Cat", x = 1, y = 1, ysize = .4)
# lots of images using a uuid
posx <- runif(50, 0, 1)
posy <- runif(50, 0, 1)
size <- runif(50, 0.01, 0.2)
# Since we are plotting a lot of the same image, we should just save
# the image in our environment first
cat <- get_phylopic("23cd6aa4-9587-4a2e-8e26-de42885004c9")
plot(posx, posy, type="n", main="A cat herd")
for (i in 1:50) {
add_phylopic_base(cat, x = posx[i], y = posy[i], ysize = size[i])
}
# Example using a cat background
# setup plot area
plot(posx, posy, type="n", main="A cat herd, on top of a cat",
xlim=c(0,1), ylim=c(0,1))
# plot background cat
add_phylopic_base(cat, alpha=0.2)
# overlay smaller cats
for (i in 1:50) {
add_phylopic_base(cat, x = posx[i], y = posy[i], ysize = size[i], alpha=.8)
}
Run the code above in your browser using DataLab