Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The coordinate positions difference between points() and geom_point() #10

Open
chenjy327 opened this issue Oct 6, 2020 · 0 comments
Open

Comments

@chenjy327
Copy link

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

the result p is:
微信图片_20201006110046

Could you tell how to solve the problem?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant