Hi:
When i was using as.ggplot() convert points() to ggplot objects, then add some points with geom_point() in the plots, i found that the points drawn using points() and geom_point() are in different positions.Here is my code:
plot_f <- function(){
plot.new()
points(df[, 1:2], cex=0.6, col=2, pch=2)
}
p <- as.ggplot(
~plot_f()
)
p <- p +
geom_point(
data = df,
aes(x = df[,1], y = df[,2]),
size = 4
)```
df is a data frame :
![微信图片_20201006110053](https://user-images.githubusercontent.com/44934994/95153944-41ddbc80-07c3-11eb-94ef-c304cf734718.png)
and the result is:
![微信图片_20201006110046](https://user-images.githubusercontent.com/44934994/95153986-591caa00-07c3-11eb-960b-d04a060c8b2b.png)
Could you tell me how to solve the problem?
Hi: When i was using as.ggplot() convert points() to ggplot objects, then add some points with geom_point() in the plots, i found that the points drawn using points() and geom_point() are in different positions.Here is my code: