I am making an algebra calculator for my CSSE (Computer Science and Software Engineering) class and I am having trouble with a portion of my project. I am trying to have my program ask the user for some input to so it can graph the given equation. I do have it set up to where it graphs an already set equation.
I have already tried making the "y = " variable ask for user input but nothing seems to be working.
# Juan Salcedo
# Plotting linear graphs
# April 26, 2019
# Calling necessary libraries
import matplotlib.pyplot as plt
import numpy as np
# Defining x and y
x = np.linspace(-5, 5, 100)
y = 2*x+1
# Calling variables x and y
# Colouring graph "red" and labeling graph
plt.plot(x, y, '-b', label='y=2x+1')
# Titling plot
plt.title('Graph of y=2x+1')
# Colouring graph in hex
plt.xlabel('x', color='#1C2833')
plt.ylabel('y', color='#1C2833')
# Giving legend
plt.legend(loc='upper left')
plt.grid()
# Calling/showing plot
plt.show()