Mar-14-2022, 04:06 PM
(This post was last modified: Mar-14-2022, 05:56 PM by deanhystad.)
_x is a numpy array. _y is a single number. Do you want to evaluate m_val*x_val+c_val for each value in _x?
import numpy as np import matplotlib.pyplot as plt slope = 2 offset = 3 x = np.linspace(-5,5,100) y = x * slope + offset plt.plot(x, y) plt.show()Another thing. This makes no sense:
x_val = int(Ex.get()) #x_val stands for x value & is used in calculationsx_val is a range, not a single value. You should have the user enter the range for x, not a single value.