2D plot from a matrix

I'm not sure if I understand you correctly because you are not providing a REPRoducible EXample (reprex). Is this what you are trying to do?

library(ggplot2)

# Made up X matrix
X <- matrix(1:100, nrow = 50, ncol = 2)
X <- as.data.frame(X)
names(X) <- c("x", "y")
head(X)
#>   x  y
#> 1 1 51
#> 2 2 52
#> 3 3 53
#> 4 4 54
#> 5 5 55
#> 6 6 56

# Plot
ggplot(X, aes(x = x, y = y)) +
    geom_point()

Created on 2019-04-07 by the reprex package (v0.2.1.9000)

1 Like