替换ggplot2.0中不推荐使用的axis.ticks.margin
在ggplot2.0中使用轴.ticks.margin时,我收到一条警告消息:替换ggplot2.0中不推荐使用的axis.ticks.margin,r,plot,ggplot2,R,Plot,Ggplot2,在ggplot2.0中使用轴.ticks.margin时,我收到一条警告消息: axis.ticks.margin不推荐使用。请改为设置轴的margin属性。text 我想我可以尝试axis.text.margin,但我收到另一条警告,说这是一个无效函数。发行说明说: 主题设置axis.ticks.margin已被弃用:现在使用axis.ticks的margin属性 那么现在边距设置在哪里呢?请参见以下页面上的ggplot 2.0文档: axis.text 沿轴勾选标签(元素\文本;从文本继承)
axis.ticks.margin
不推荐使用。请改为设置轴的margin
属性。text
我想我可以尝试axis.text.margin
,但我收到另一条警告,说这是一个无效函数。发行说明说:
主题设置axis.ticks.margin
已被弃用:现在使用axis.ticks的margin属性
那么现在边距设置在哪里呢?请参见以下页面上的ggplot 2.0文档:
axis.text
沿轴勾选标签(元素\文本;从文本继承)
这应该在元素\文本元素中。它指向函数margin
。按照这些思路应该可以做到:
+ theme(axis.text.x = element_text(margin=margin(5,5,10,5,"pt")),
axis.text.y = element_text(margin=margin(5,5,10,5,"pt")))
谢谢似乎我们必须分别调整x和y的边距。对于x,仅顶部和底部工作;对于y,仅右侧和左侧工作。它给了我们更大的力量来精细地调整它们,但与早期版本相比更复杂。@Chuanxin我认为您不必单独设置它们。只需执行axis.text=element_text(…)
@C8H10N4O2,它们确实需要单独设置,因为答案和Chuaxwin的注释都需要注意