I want to show the frame in this figure. I tried running the code below but it didnt work :
ax = self.canvas.figure.add_subplot(111)
ax.spines[\'top\'].set_vis
The borders (or spines) are already visible, but white. You need to change the color as explained in this response: https://stackoverflow.com/a/43265998/1773344
example for some kind of gray:
ax.spines['bottom'].set_color('0.5')
ax.spines['top'].set_color('0.5')
ax.spines['right'].set_color('0.5')
ax.spines['left'].set_color('0.5')
If you want the borders AROUND the axes, there is no simple solution. Except perhaps putting your axis inside an axis with adjusted borders as partially explained in this answer: https://stackoverflow.com/a/22608025/1773344