0
Hello. Is there any way I can first open a chart with matplotlib and, after opened, perform some operations? Ex: open graph and then plot a straight line, then another, so on.
I know there are some topics in English stackoverflow about this, and the solution that comes closest to my problem says to use the
plt.io()
and then
plt.show()
I did this, but the graph hangs in such a way that it doesn’t even respond. My goal here is to initialize the blank graph and then plot some lines.
My code so far:
def startPlot():
plt.title('Adaline')
plt.axis([-0.2, 1.2, -0.1, 1.4])
plt.grid()
#plots the dots
plt.plot([0, 0, 1, 1], [0, 1, 0, 1], 'ro')
plt.draw()
def printCurve(weights, bias):
plt.title('Adaline')
t = np.arange(0.0, 1.0, 0.001)
f = (-weights[1] * t - bias)/(weights[0])
#plots the curve
plt.plot(t, f, 'k')
plt.draw()
I call startPlot() once and printCurve() several times. I want to call plt.show() first of all, but if I do this or make plt.show(break=True), don’t plot anything else after that.