I have an ascii file i with two variables and I want to create a scatterplot and add the line y=x in the scatterplot. The code for creating the scatterplot is below.
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
val1 = np.loadtxt(i, usecols=0)
val2 = np.loadtxt(i, usecols=1)
fig, ax = plt.subplots(1, 1)
fig.set_size_inches(6, 6)
plt.scatter(val1, val2)
plt.savefig(outfile, bbox_inches='tight', format='png', dpi=200)
How to define the plot of line y = x without define the axis scale? Because the scale of the axes is dynamic based on the data. I want to do that for multiple files.

plt.plot(val1, val1)might work