gpt4 book ai didi

r - 网格线与轴上的刻度一致

转载 作者:行者123 更新时间:2023-12-02 04:25:33 26 4
gpt4 key购买 nike

我很尴尬地问这个简单的问题,但每当我创建一个情节时,我已经好几天了:

plot (x = 1:10, y = rnorm (10, 5, 2))
grid (10,10, lty = 6, col = "cornsilk2")

我想将网格放置在轴标记的位置,即 x 轴上的 2、4、6、8、10 处,类似地,y 轴上的 3、4、5、6、7、8 处。

enter image description here

我想自动化该过程,因为只要绘图大小发生变化,默认标签行为就会发生变化。请参阅以下情节:

enter image description here

最佳答案

来自 ?gridnxny 参数的描述:

When NULL, as per default, the grid aligns with the tick marks on the corresponding default axis (i.e., tickmarks as computed by axTicks)

plot (x = 1:10, y = rnorm (10, 5, 2)) 
grid (NULL,NULL, lty = 6, col = "cornsilk2")

关于r - 网格线与轴上的刻度一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8081931/

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