I`m using matplotlib to plot a reward vs episode plot in a reinforcement learning application. So basically I update the plot every time the episode ends. Searching here python-How do I plot in real time in a while loop using matplotlib I get to make my plot update every time my episode finished. My code for the plot is:
reward_plot = plt.plot(i,total_reward, '-ro')
plt.title('Reward vs episodes')
plt.xlabel("Episodes", fontsize=12)
plt.ylabel("Reward", fontsize=12)
plt.pause(0.05)
And the plot, actually looks like this:
I just want to make the plot draw a line linking the dots each time the graph is updated. It is possible? I tried with different methods but I didn't have any luck. I'm using Python 3.6.6.