2
我正在嘗試縮小我的長軸標籤之間的間距。我基地R圖形我應該使用lheight
,但似乎沒有影響ggplot。是否有一個ggplot等價物?ggplot中文本的線高度間距
玩具例子來說明這個問題:
library("tidyverse")
df0 <- mtcars %>%
rownames_to_column("car") %>%
mutate(car = str_wrap(car, width = 10))
ggplot(data = df0, aes(x = car, y = mpg)) +
geom_bar(stat = "identity") +
coord_flip()
# has no effect
par(lheight = 0.5)
ggplot(data = df0, aes(x = car, y = mpg)) +
geom_bar(stat = "identity") +
coord_flip()
參見'ggsave','png' /'jpg'和/或與'主題指定文本的大小(axis.text = element_text(大小= ..)' – Jaap
@ ProcrastinatusMaximus據我所知,這會減少文本的大小(以及行間距),而不僅僅是行之間的空間大小......這就是我所追求的 – gjabel
如果我們在「避免重疊「,我們可以左對齊多個行名稱,並右對齊單行名稱? – zx8754