# Plotting igraph nodes on a Cartesian plane

Hi all,

I am trying to plot a graph on a Cartesian plane (Image 1 is the original graph). The graph has fixed number of nodes and the connections between nodes are constant. The graph is undirected.

I managed to create the graph using igraph and plot in using ggraph() (see Image 2). I have included the code I used to plot it with ggraph. However, with the latest upgrade the ggraph() is unable to draw the plot.

Can you please suggest me a way to achieve (plotting on a Cartesian plane) the same in igraph? I am using R 4.0.3.

``````library(igraph)
library(tidyverse)
library(ggraph)

#Setting Node coordinates
V <- read.table(text = "x y
2 1
4 2
4 4
2 5
6 4
3 7
8 6",
tibble::rownames_to_column("name")

#connection between nodes
E <- matrix(c(0,    1,    0,    0,    0, 0, 0,
0,    0,    1,    0,    0, 0, 0,
0,    0,    0,    1,    1, 0, 0,
0,    0,    0,    0,    0, 1, 0,
0,    0,    0,    0,    0, 0, 1,
0,    0,    0,    1,    0, 0, 0,
0,    0,    0,    0,    1, 0, 0), nrow = 7, byrow = T) %>%
data.frame() %>%
rename_all(list(function(x) 1:7)) %>%
tibble::rownames_to_column(var = "from") %>%
gather(to, val, 2:6) %>%
filter(val == 1) %>%
select(from, to)

#generate the igraph
g <- graph_from_data_frame(E, vertices = V, directed = F)

#plot the graph

ggraph(g) +