使用矩阵图(MATPLOT)作为地图和位置作为位置
我有兴趣将矩阵图用作现场图,而矩阵中的某些位置作为特定植物(现场内的位置)。 我正在使用此数据:
Field<-matrix(1:1240,nrow = 40,ncol = 31)
SampTreatment<- sample(Field,6,replace = F) # Results: 388 155 582 405 1173 165
SampControl<- sample(Field,6,replace = F) # Results: 848 270 1159 1050 1177 1184
我正在尝试使用:
matplot(Field,col = 1,pch = 1,lty = 1)
points(SampControl,col= 'blue',pch=19,cex=1.5)
points(SampTreatment,col= 'red',pch=17,cex=1.5)
问题是,该图似乎没有在正确的位置显示位置。
I'm interested in using a matrix plot as a field map and certain locations in matrix as specific plants (locations within field).
I'm using this data:
Field<-matrix(1:1240,nrow = 40,ncol = 31)
SampTreatment<- sample(Field,6,replace = F) # Results: 388 155 582 405 1173 165
SampControl<- sample(Field,6,replace = F) # Results: 848 270 1159 1050 1177 1184
I'm trying to plot it using:
matplot(Field,col = 1,pch = 1,lty = 1)
points(SampControl,col= 'blue',pch=19,cex=1.5)
points(SampTreatment,col= 'red',pch=17,cex=1.5)
and getting:
The issue is that it seems the plot is not showing locations in the right place.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,您可能需要像这样创建矩阵,
并且如注释中所建议的,
示例
x和y坐标。只需将过程包裹在小功能中。现在请注意,
matplot
转台,因此您还需要t
翻转。更好的是,我们使用自定义轴
es避免分数。First, you may want to create your matrix like so,
and, as already suggested in comments,
sample
x and y coordinates. Just wrap the process in asmallfunction.Now note, that
matplot
transposes, so you also need tot
ranspose. Better we use customaxis
es to avoid fractions.