I am learning matplotlib.
I am trying to plot two below plots in a single plot using matplotlib.
Here is my code.
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
train_error = [0.26462888486225206, 0.26462383329393313, 0.2628674962680674, 0.2553700231555298, 0.17473717177688022, 0.14773444580059242, 0.1468299949185866, 0.1468235689407127, 0.1439370366766204]
test_error = [0.8438224756653776, 0.8442034650577578, 1.018608707726192, 4.853704454584892, 123.69312582226338, 798.4569874115062, 3205.5264038946007, 9972.587330411312, 10787335.618580218]
plt.plot(train_error)
plt.plot(test_error)
plt.show()
Where am i doing wrong ? Can anyone please guide / help ?



test_errorhas values from 0 to 1e7 (10,000,000) andtrain_errorhas values from 0.14 to 0.27. If you plot them with a single, linear y axis,train_errorand most oftest_errorwill look like zero, as shown in your second example.test_error.plt.yscale('log')as shown at matplotlib.org/stable/tutorials/introductory/….