本文介绍了网格线与坐标轴上的刻度一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很尴尬地问这个简单的问题,但是每当我创建一个情节时,我一直在嘲笑我的思想:

 <$ c $ (10,10,lty = 6,col =cornsilk2)

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





我希望自动执行该过程,因为每当绘图大小更改默认标签行为更改时。看到下面的图:



nx 和 ny 参数:



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


I am embarrassed to ask this simple question, but has been in kicking my mind for several days whenever I create a plot:

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

I want to position the grids right at where axis are labelled, i.e. at 2, 4, 6, 8, 10 in x axis and similarly 3, 4, 5, 6, 7, 8 in y axis.

I want to automate the process as whenever the plot size changes the default label behaviour changes. See the following plot:

解决方案

From ?grid description of the nx and ny arguments:

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

这篇关于网格线与坐标轴上的刻度一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 13:25