默认的ggplot2绘图边距是多少? [英] What are the default ggplot2 plot margins?

查看:335
本文介绍了默认的ggplot2绘图边距是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在任何地方都找不到有关此信息.我知道如何设置它们,但想知道默认值(上,右,下和左),因此在为绘图设置边距时,它不像是一个猜谜游戏.

I cannot find information on this anywhere. I know how to set them but want to know the defaults (top, right, bottom, and left) so its less of a guessing game when setting margins for a plot.

推荐答案

对于图边距以及其他参数,默认值为theme_grey:

For plot margins as well as other parameters, the default values are that of theme_grey:

theme_grey()$plot.margin
[1] 5.5pt 5.5pt 5.5pt 5.5pt

但是,默认主题将来可能会更改,您可以设置另一个主题(使用theme_set()),因此更健壮的方法是使用theme_get()来返回当前主题(@ r2evans注释)

However, the default theme might change in the future, and you can set a different one (with theme_set()) so a more robust way would be to use theme_get() which returns the current theme (@r2evans comment)

theme_get()$plot.margin 

这篇关于默认的ggplot2绘图边距是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆