在ggplot中,为什么必须单独将axis.text.x和axis.text.y设置为element_blank()而不是仅仅是axis.text?
此代码产生此图:
ggplot(mtcars, aes(x = cyl, y = mpg))+
geom_line()+
theme(axis.text = element_blank())
似乎axis.text
参数没有 工作。为了使其正常工作,需要做到这一点:
ggplot(mtcars, aes(x = cyl, y = mpg))+
geom_line()+
theme(axis.text.x = element_blank(),
axis.text.y = element_blank())
我的问题是为什么?
This code produces this plot:
ggplot(mtcars, aes(x = cyl, y = mpg))+
geom_line()+
theme(axis.text = element_blank())
Where it seems that axis.text
argument doesn't work. In order to make it work, one needs to do this:
ggplot(mtcars, aes(x = cyl, y = mpg))+
geom_line()+
theme(axis.text.x = element_blank(),
axis.text.y = element_blank())
My question is why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
axis.text
根据文档:时,当我运行您的代码时,它确实有效:
在20222222222222222222222年创建-07-05 by reprex软件包(v2.0.1)
axis.text
according to document:When I run your code it does work:
Created on 2022-07-05 by the reprex package (v2.0.1)