I'm unable to provide a solution for now, but I think one possible reason for the points to be so overlapping is that the nodes are not actually plotted by latitudes and longitudes. I think some shift of location and scale has taken place. You can check this by plotting the axes (see the limits of the x and y axes below, and compare with the ranges of lat and long):
library(igraph)
#>
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#>
#> decompose, spectrum
#> The following object is masked from 'package:base':
#>
#> union
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:igraph':
#>
#> as_data_frame, groups, union
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
attach(quakes)
cutfor_graph <- cut(x = depth,
breaks = 6)
data_for_graph <- mutate(.data = quakes,
cutfor_graph)
range(lat)
#> [1] -38.59 -10.72
range(long)
#> [1] 165.67 188.13
eg <- make_empty_graph(n = 1000,
directed = F)
plot.igraph(x = eg,
axes = TRUE,
layout = as.matrix(x = select(.data = data_for_graph,
lat,
long)),
vertex.color = data_for_graph$cutfor_graph,
vertex.size = data_for_graph$mag*5,
main = "network of quakes")
legend("bottomleft",
legend = levels(x = as.factor(x = cutfor_graph)),
col = c("red", "blue", "black", "yellow", "orange", "green"),
lty = 2,
pch = 20,
pt.cex = 4,
cex = 1)
