導(dǎo)讀
這里記錄兩個(gè)Y叔的繪圖方法??梢援媏moji的R包emojifont,可以畫輪廓的ggimage geom_phylopic函數(shù)。
一、emojifont
emoji庫(kù):https://emojiterra.com/vegetables/
geom_emoji不支持大寫
1 11.25西方感恩節(jié)吃火雞
install.library("emojifont")
library("emojifont")
library("ggplot2")
ggplot() + geom_emoji('turkey', color="steelblue") +
labs(x="", y="") +
theme(axis.ticks = element_blank()) +
theme(axis.text = element_blank()) +
theme(axis.title = element_blank())

2 玫瑰rose
ggplot() + geom_emoji('rose', color="red") +
labs(x="", y="") +
theme(axis.ticks = element_blank()) +
theme(axis.text = element_blank()) +
theme(axis.title = element_blank())

3 蘑菇mushroom
ggplot() + geom_emoji('mushroom') +
labs(x="", y="") +
theme(axis.ticks = element_blank()) +
theme(axis.text = element_blank()) +
theme(axis.title = element_blank())

二、ggimage
1 準(zhǔn)備
USA (IA) 鏡像 + 翻墻 安裝ggimage(無依賴)
HONGKONG 鏡像 + 翻墻 安裝rvcheck (ggimage依賴包)
GUANGZHOU 鏡像 安裝magick (ggimage依賴包)
2 耗子尾汁 rat tail solution
library("magick")
library("rvcheck")
library("ggimage")
options(phylopic_width=128)
mouse = 'Mus musculus'
id = phylopic_uid(mouse)
d = data.frame(x=0:1, y=0:1)
ggplot(d, aes(x=x, y=y)) +
geom_blank() +
geom_phylopic(aes(image=uid),
data=id,
x=.5, y=.5, size=.8
) +
geom_phylopic(aes(image=uid),
data=id,
x=.2, y=.85, size=.3,
colour = 'steelblue', angle=180
) +
labs(x=NULL, y=NULL,
title='耗子尾汁',
subtitle = '做學(xué)術(shù)要講倫理')

3 貓咪
options(phylopic_width=128) # 抓的是128px的圖,其他數(shù)字報(bào)錯(cuò)哦
sth = 'Felis catus' # 科學(xué)名
id = phylopic_uid(sth) # uid對(duì)應(yīng)了相應(yīng)的圖
d = data.frame(x=0:1, y=0:1)
ggplot(d, aes(x=x, y=y)) +
geom_blank() +
geom_phylopic(aes(image=uid), data=id, x=.5, y=.5, size=.4, colour = 'steelblue')

4 火烈鳥
sth = 'Phoenicopteridae' # 科學(xué)名
id = phylopic_uid(sth) # uid對(duì)應(yīng)了相應(yīng)的圖
d = data.frame(x=0:1, y=0:1)
ggplot(d, aes(x=x, y=y)) +
geom_blank() +
labs(x="", y="") +
theme(axis.ticks = element_blank()) +
theme(axis.text = element_blank()) +
theme(axis.title = element_blank()) +
geom_phylopic(aes(image=uid), data=id, x=.5, y=.5, size=.4, colour = 'red')
