I used the following code to create a plot for my knights tour matrix:
Mat = matrix(c(50, 43, 30, 61, 14, 63, 28, 7,
31, 60, 51, 42, 29, 8, 13, 64,
44, 49, 58, 25, 62, 15, 6, 27,
59, 32, 45, 52, 41, 26, 9, 12,
48, 53, 40, 57, 24, 11, 16, 5,
39, 56, 33, 46, 35, 18, 21, 10,
54, 47, 2, 37, 20, 23, 4, 17,
1, 38, 55, 34, 3, 36, 19, 22), nrow=8, ncol=8, byrow=T)
coords <- tibble(col = rep(1:8, 8),
row = rep(1:8, each = 8))
coords %>%
mutate(order = Mat[8 * (col - 1) + row]) %>%
arrange(order) %>%
ggplot(aes(x = col, y = row )) +
geom_path() +
geom_text(aes(y = row + 0.25, label = order)) +
coord_equal()
while it works fine for 8x8 chessboards:
https://imgur.com/a/QZpQkWc
It looks unreadable for large chessboards, dues to the huge amount of numbers overlapping each other, 75x75 size chessboard path:
Is there a way to hide the numbers within the plot itself ?
I am not too good with R, so don't know if it is the best way to do it, but I don't have a lot of time to write anything better