This may sound like a very naive question. However, to me, it's quite fundamental: Can python plot variables without putting them into arrays or lists? I couldn't find much answer on the net or SO and please let me know if there's any duplicate.
I have the following code for demonstration:
import matplotlib.pyplot as plt
import numpy as np
x = 0.0
dx = 0.5
for i in range(10):
y = x**2
plt.plot(x,y)
x += dx
plt.show()
x = np.linspace(-0,.5,10)
y = x**2
plt.plot(x,y)
plt.show()
The first part doesn't plot (which is in an explicit for-loop) anything while the second part does (where both x and y are numpy arrays).
Is it possible to plot without storing variables in arrays or lists? plt.scatter(x,y,c='r') works but that doesn't produce any line plot.
