0

I am working on plotting a graph in matplotlib. The coordinates value keep changing every time a new point is added. I want to fix both the axes coordinates to a maximum value and the values shouldn't change even when many points are added.

I found the code only to fix the axes in a particular position and not the coordinates.

for i in range(len(xi)):
    xia.append(xi[i])
    tempya.append(tempy[i])
    fig = plt.figure()
    ax = fig.add_subplot(1, 1, 1)
    x = np.linspace(-10,10,200)
    ax.grid(True, which='both')
    ax.spines['left'].set_position('center')
    ax.spines['right'].set_color('none')
    ax.spines['bottom'].set_position('center')
    ax.spines['top'].set_color('none')
    ax.spines['left'].set_smart_bounds(True)
    ax.spines['bottom'].set_smart_bounds(True)
    ax.xaxis.set_ticks_position('bottom')
    ax.yaxis.set_ticks_position('left')
    plt.text(int(xi[i]), int(tempy[i]), str(ans[i]), fontsize=8)
    ax.scatter((xia),(tempya))
    plt.show()

Image 1

Image 2

Paul92
  • 8,827
  • 1
  • 23
  • 37
its-akhr
  • 122
  • 1
  • 1
  • 10

0 Answers0