0

I'm making a simple word game simulation in Python and need a way to visualise a grid of coordinates. The input would be a simple 2D array with either '' or a character in each spot.

I need each spot in the grid to either be blank or have one letter. The x and y axes need to have arbitrary start points, such as -20. It seems like Matplotlib might do what I want, but having looked around on a bunch of Stackoverflow questions and Matplotlib help pages, I can't find what I need. The question here partly has what I need: Show the values in the grid using matplotlib

Except I want no colour, the values are single characters, and the axis labels need to allow arbitrary start points.

Does anyone know whether Matplotlib is the right library to do this sort of thing, or if I should try something else? Performance matters but it's not the most important thing. I don't need any interactivity with the display window, it's purely read only.

user1709291
  • 43
  • 1
  • 8
  • Yes, matplotlib can be used. The color in the linked question is produced by the `matshow` command, which you can leave out of course. The starting and end of axes are determined by `ax.set_xlim`, `ax.set_ylim`. – ImportanceOfBeingErnest Jul 27 '19 at 12:09
  • @user1709291 I am guessing you also want to refresh your screen contents without new pop up being displayed for every refresh. If I were you, I will invest my time in Tkinter or Pyside/QtPy. The learning curve is much higher for these but a good uninterrupted user experience (because you are trying to develop a game) is more likely to be there with these three than in matplotlib. All the best – Amit Jul 27 '19 at 14:14
  • @ImportanceOfBeingErnest Thanks. I'm still having an issue with the data though. I cannot represent a single character as being plotted in the negative. For example. If I have an 'A' at -1x, -1y, I cannot manage that by passing in the A in a particular position in the 2D array data. It only understands 0x0y or greater. – user1709291 Jul 28 '19 at 12:41
  • That's too vague. You may always show the minimal runnable version of code you have a problem with to ask for specific problems though. – ImportanceOfBeingErnest Jul 28 '19 at 12:43

0 Answers0