gpt4 book ai didi

r - R plot函数中不需要的默认粗轴线

转载 作者:行者123 更新时间:2023-12-04 10:31:48 25 4
gpt4 key购买 nike

当我在 R 中绘制任何绘图时,它总是会沿着周围框的编号部分产生一条较粗的轴线。这是一个麻烦,因为我必须始终在 plot() 中关闭轴,然后以零厚度重新绘制它们。我注意到其他实验室同学的电脑似乎没有这个问题,这让我想知道问题出在哪里。

图 1 生成了我不需要的粗轴线,图 2 可作为解决方案:

x<-c(1:10)
y<-c(1:10)
# Plot 1
plot(x,y, main="Plot 1")
# Plot 2
plot(x, y, xaxt='n', yaxt='n', main="Plot 2")
axis(1, lwd=0, lwd.ticks=1)
axis(2, lwd=0, lwd.ticks=1)

我在 Mac OSX 10.9.4 上运行 RStudio 0.98.501

任何关于错误根源的想法都非常感谢。谢谢。

enter image description here

enter image description here

最佳答案

您可以创建一个新的绘图函数,类似这样的东西应该可以工作:

plot = function(x, y, ...){
plot(x, y, xaxt='n', yaxt='n')
axis(1, lwd=0, lwd.ticks=1)
axis(2, lwd=0, lwd.ticks=1)
}

关于r - R plot函数中不需要的默认粗轴线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26757921/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com