增加y轴上文本和标题之间的距离 [英] Increase distance between text and title on the y-axis
问题描述
ggplot(mpg,aes(cty,hwy) )+ geom_point()
我试着用 theme()$ c来改变许多参数的值
从 ggplot2 2.0.0 $ c $> c>您可以使用
element_text()
的 margin =
参数来更改轴标题和数字之间的距离。在 t
op上设置保证金
的值, r
ight, b
ottom,并且 l
元素的右边。
ggplot(mpg,aes(cty,hwy))+ geom_point()+
主题(axis.title.y = element_text(margin = margin(t = 0) ,r = 20,b = 0,l = 0)))
margin
也可用于其他 element_text
元素(请参阅?theme ),例如
axis.text.x
, axis.text.y
和 title
。
The y-axis title appears too close to the axis text.
ggplot(mpg, aes(cty, hwy)) + geom_point()
I have tried changing the value of many parameters with theme()
but none seems to help.
From ggplot2 2.0.0
you can use the margin =
argument of element_text()
to change the distance between the axis title and the numbers. Set the values of the margin
on t
op, r
ight, b
ottom, and l
eft side of the element.
ggplot(mpg, aes(cty, hwy)) + geom_point()+
theme(axis.title.y = element_text(margin = margin(t = 0, r = 20, b = 0, l = 0)))
margin
can also be used for other element_text
elements (see ?theme
), such as axis.text.x
, axis.text.y
and title
.
这篇关于增加y轴上文本和标题之间的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!