如何解决ggtext在字幕和标题之间创建过多的空白
我在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 举报,一经查实,本站将立刻删除。