-1

How can I set my y-axis to range between 0 to 100? This is my code:

fig, ax = plt.subplots()
plt.plot(history.history['accuracy'], marker="*", label='Train accuracy', color='blue')
plt.plot(history.history['val_accuracy'], marker="o", label='Test accuracy', color='red')
plt.title('Plot' )
plt.ylabel('yaxis')
plt.xlabel('xaxis')
plt.legend(loc='best')
plt.show()
osulloc55
  • 21
  • 4

1 Answers1

1

One way to do it would be to use ylim, as in:

...
plt.xlabel('xaxis')
plt.legend(loc='best')
plt.ylim(0,100).         # <== This is the relevant piece. 
plt.show()
Roy2012
  • 11,755
  • 2
  • 22
  • 35