小编Kar*_*ati的帖子

如何在ggplot2中添加X和Y点坐标?

我正在尝试制作 ggplot,如何添加点的 x 和 y 坐标?我尝试了这段代码,但它不起作用:

d4<-Restriangle[1:(n-1),5]
xaxis=c(1:(n-1))
yaxis=Restriangle[1:(n-1),4]
data=data.frame(xaxis,yaxis)
library(ggplot2)
res=ggplot(df, aes(x = d, y = d4)) +  
# Set up canvas with outcome variable on y-axis
geom_point(data=data,size=4, shape=19,color = "blue"),aes(x = xaxis, y 
 = yaxis) )  
# Plot the actual points
res
Run Code Online (Sandbox Code Playgroud)

当这样做时我得到这个

输出

如何添加 XY 点坐标?

>Restriangle 
        1          2           3           4          5         6         
7
1  -897.75585 -412.69207   0.6328851    4.276630 -55.581006 -32.54413 
-84.15410
2 -1126.80146 -177.45009 -96.0334938   -4.558513 -48.247435 -78.89057  
29.46455
3  -402.33108 -101.71760  48.3551429 -149.761948  21.155187  50.29719  
50.74081 …
Run Code Online (Sandbox Code Playgroud)

visualization r ggplot2

0
推荐指数
1
解决办法
8292
查看次数

标签 统计

ggplot2 ×1

r ×1

visualization ×1