删除 error.bars 中的 x 轴
我今天遇到了一个问题,我想从下面的 R 图中删除 x 轴,但它不会消失。我希望轴位于顶部。 有人能帮助我吗?
library(psych)
temp <- describe(attitude)
error.bars(stats=temp,xaxt="n")
axis(3)
I've been having a problem today, I want to remove the x-axis from the following R-plot, but it just won't disappear. I want the axis to be on top.
Is anybody able to help me?
library(psych)
temp <- describe(attitude)
error.bars(stats=temp,xaxt="n")
axis(3)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用
fixInNamespace()
编辑psych
命名空间中的error.bars()
函数。尝试:这将在基本文本编辑窗口中打开该功能。找到
axis()
调用并注释掉您不需要的调用。退出编辑器,R 将更新 NAMESPACE 中的函数。然后再次尝试使用该功能。
或者,您可以将
error.bars()
的代码打印到提示符中,将其复制到文本编辑器中,更改函数的名称,例如my.error.bars,并像以前一样注释掉
axis()
调用。将函数保存在文件中,并将其source()
到您的会话中,或者复制并粘贴该函数。然后根据您的需要使用。第三种选择是弄清楚
error.bars()
如何进行基本绘图 - 查看代码。自己重新创建该图,不带轴,然后使用add = TRUE
调用error.bars()
。You can use
fixInNamespace()
to edit theerror.bars()
function in thepsych
NAMESPACE. Try:That will open the function in a rudimentary text editing window. Find the
axis()
calls and comment out the ones you don't want. Exit the editor and R will update the function in the NAMESPACE.Then try using the function again.
Alternatively, you can print the code for
error.bars()
to the prompt, copy it into a text editor, change the name of the function, say tomy.error.bars
, and comment out theaxis()
calls as before. Save the function in a file andsource()
it into your session or copy and paste the function in. Then use to your heart's desire.A third alternative, is to work out how
error.bars()
does it's base plotting - look at the code. Recreate that plot yourself, without axes, then callerror.bars()
withadd = TRUE
.如评论中所示,您可以编辑源代码。最简单的方法可能是使用“修复”:
应该弹出一个编辑器。将 axis(1,.etc) 调用更改为 axis(3,.etc)。然后你有一个名为 eb() 的新函数,其工作方式类似于 error.bars。
您可能还想调整其他一些东西,例如标题放置在顶部时会踩在轴上。
As in the comment, you can edit the source code. Easiest way is probably to use 'fix':
should pop up an editor. Change the axis(1,.etc.) calls to axis(3,.etc.). Then you have a new function called eb() that works like error.bars.
You might want to tweak some other things too, like the title which stomps on the axes when placed at the top.
只是为了展示加文对 add=T 的含义:
给出:

Just to show what Gavin means with add=T :
gives :
