我正试图在光栅图层的某些坐标上绘制点。
> head(coords_df)
x y
1 66.5 66.5
2 67.0 66.5
3 67.5 66.5
4 68.0 66.5
5 68.5 66.5
6 69.0 66.5
我尝试使用以下方法绘图
plot(CNRM_1)
points(coords_df, pch=16)
光栅正在绘制,但点没有绘制。在哪里修复这个问题有帮助吗?
> dput(head(CNRM_1))
structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.000796599906001783, 0,
0, 0, 0, 0, 0, 0, 0, 0.000837936005501152, 0.000871552319509912,
0.00100709419004943, 0, 0, 0.0012105632950364, 0, 0, 0, 0, 0.00103714216752641,
0.00104333072151312, 0.000794459549629719, 0.00198828994745526,
0.00232027342913862, 0.00152433704387084, 0.00145669475130489,
0, 0, 0, 0.00106764166637498, 0.00133117261345192, 0.000751185736039872,
0.00205181592210355, 0.00235624992234934, 0.00160364560215041,
0.00225981611592611, 0, 0, 0, 0.00094873888615985, 0.00159345054110917,
0.000750502129892894, 0.00166613986487262, 0.00245039132047496,
0.00204705133350925, 0.00264872849452662, 0, 0, 0, 0.000704677797913744,
0.00158751407612522, 0.00105819696412664, 0.00112746366228874,
0.00220263084576204, 0.00300220982410644, 0.00268456275374276,
0, 0, 0, 0, 0.00112959733971154, 0.00153415586525737, 0.000503537889893361,
0.000948829835912542, 0.00221998566976762, 0.0031083088899198
), dim = c(10L, 20L), dimnames = list(c("1", "2", "3", "4", "5",
"6", "7", "8", "9", "10"), c("1", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18",
"19", "20")))
> dput(head(coords_df))
structure(list(x = c(66.5, 67, 67.5, 68, 68.5, 69), y = c(66.5,
66.5, 66.5, 66.5, 66.5, 66.5)), row.names = c(NA, 6L), class = "data.frame")
2条答案
按热度按时间epggiuax1#
不确定CNRM_1的图应该是什么样子,可以尝试 image,然后添加 points:
8zzbczxx2#
coords_df
中的points
未显示的原因是CRNM_1
和coords_df
之间的x轴和y轴不同。我同意很难看出您希望最终图是什么样子,
image
可能是最佳选择。但是,由于您在原始方法中使用了plot(CNRM_1)
,因此要添加coords_df
中的点,您需要使用par(new = TRUE)
添加新图