Skip to content

integer formatting does not work in Python

I am trying to save my images with the time epoch plus iterating integers like this: text_img.save(‘/content/result/’ + epoch + ‘_%03d’ + ‘.png’ , format=”png”) However, the output is something like this: 16087965_%03d.jpg The formatting does not work for some r…

Change displot bar colors to a specific color

I am struggling to change my displot bar colours. I want to change the colour of the bars to the light blue colour on at the end of the palette (shown below). I have tried this, but the colour seems to remain as a dark blue, which is not what I want. How do I change the colours to a

Drawing a rectangle with Matplotlib

I’m writing a python function to draw a simple rectangle, the vertex points are parameters. Well, this does not work correctly and I can’t seem to find out why its plotting all over the place. EDIT: as for my imports. So sp is sympy. As for the expected result to draw a rectangle of course. Actual…

How to reset the index counter?

I’m implementing a game (connect four). A player makes a move by selecting a column number to place their checker in, when the column is empty the checker is placed at row index (-1) if not I’m decrementing the index by -1. I am having trouble resetting the row index so that after both players pla…