问题描述
我在ggplot
中创建了一个情节,并且正在使用ggtext
为字幕中的特定单词着色。尽管可行,但每次渲染图时,顶部都会有过多的空白。下面是有助于呈现文本的代码,这就是output。对我该怎么办有什么想法?
filter(threatened == 1,!is.na(year_last_seen)) %>%
count(year_last_seen,threat_type) %>%
pivot_wider(names_from = year_last_seen,values_from = n) %>%
mutate_if(is.integer,as.numeric) %>%
mutate_all(~replace(.,is.na(.),0)) %>%
nest(c('1900-1919','1920-1939','1940-1959','1960-1979','1980-1999','2000-2020')) %>%
mutate('2020_sum' = map_dbl(data,sum)) %>%
unnest() %>%
mutate(threat_type = fct_reorder(threat_type,`2020_sum`)) %>%
ggplot() +
geom_dumbbell(aes(y = threat_type,x = `Before 1900`,xend = `2020_sum`),color='#E7E3D9',size = 1.5,colour_x = '#1E5871',colour_xend = '#8F0700',size_x = 4,size_xend = 4) +
# This is the text that is helping me colorize particular words in the subtitle.
labs(title = "Number of Plants Threated",subtitle = "Change from <b style='color:#1E5871'>< 1900</b> through <b style='color:#8F0700'>2020</b>",x = '',y = '') +
theme(plot.subtitle = element_markdown())```
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)