[Python] Drawing a simple path through a grid

Discussão em 'Python' iniciado por Stack, Maio 22, 2025.

  1. Stack

    Stack Membro Participativo

    I have a list of cells:

    my_path = [(4, 4), (4, 3), (3, 3), (2, 3), (2, 4), (1, 4), (0, 4), (0, 3), (0, 2), (1, 2), (1, 1), (1, 0), (0, 0)]


    that represent a path through a 5x5 grid. I'm looking for a straightforward way of drawing the path and grid something like this (as long as they contrast, the actual colours aren't important):

    [​IMG]

    I've looked at things like Python - Plotting colored grid based on values, Drawing grid pattern in matplotlib, custom matplotlib plot : chess board like table with colored cells, but they seem too complicated for what I want. Thank you.

    Continue reading...

Compartilhe esta Página