CodePudding user response:
The first post the wrong, sorryCodePudding user response:
This is the old version of the change, not build window figure, with PLT directly. The scatter (x_data, y_data) create diagrams, PLT again. The show (), and then open the interactive mode PLT. Ion (), then the window object in the for loop training ax into the PLT. Plot (... ), and then write code delay, specific as follows:PLT. Scatter (x_data y_data)
PLT. The show ()
PLT. Ion ()
Step # training 1000
For I in range (1000) :
# training
Sess. Run (train_step, feed_dict={xs: x_data, ys: y_data})
If I % 50==0:
# see training data learning improve
# print (1 - sess. Run (loss, feed_dict={xs: x_data, ys: y_data}))
Prediction_value=https://bbs.csdn.net/topics/sess.run (prediction, feed_dict={xs: x_data})
PLT. Cla ()
PLT. Scatter (x_data y_data)
Lines=PLT. The plot (x_data prediction_value, 'r -, lw=5)
PLT. Pause (0.5)
CodePudding user response:
% matplotlib, it is ok to run after, picture is not indicated in the notebook, but out of a window, so that you can dynamically display, if you want to switch back to the image displayed in the notebook, can run % matplotlib inline,CodePudding user response:
Found PYCharm shows dynamic figure to separate the pop-up Windows, detailed setting method is as follows:File - & gt; Settings - & gt; Tools - & gt; Python scientific - & gt; To cancel the Show plots in tool in front of the window)