1

I want to display a sudoku grid from the values in an array.

Here's my code

fig, ax =plt.subplots(1,1)
ax.axis('tight')
ax.axis('off')
ax.table(cellText=sudoku2,loc="center")
plt.show()

And here's my output sudokugrid

How do I get the cells to be squares ? I'm lost.

SteveAdmin
  • 11
  • 2
  • try this:`ax.set_aspect('equal')` – r-beginners Dec 18 '20 at 10:17
  • hmm it's better, but still not square [link](https://i.imgur.com/GyygH3Z.png) How does it work exactly ? – SteveAdmin Dec 18 '20 at 10:55
  • `ax.table(cellText=sudoku2, colWidths=[0.05]*9,loc="center")`Since the table parameters are only cell widths, I think it is difficult to use squares. A different approach would be needed. – r-beginners Dec 18 '20 at 12:55
  • The logic of the [Sudoku solver](https://github.com/ipower2/Sudoku-Solver/blob/master/sudokusolver/plotutilities.py) created by @ipower2 may be helpful. Please refer to it. – r-beginners Dec 18 '20 at 13:02

0 Answers0