Matplotlib Tutorial 16 - Live graphs

sentdex · 364K views · 2015 · 8:40

Open on YouTube

Data visualization & information designPython, Ruby & scripting languagestutorial

Why Stack Overflow recommends it

Stack Overflow users link it when someone needs a real-time or continuously updating matplotlib plot, and as the origin of code in questions about animation problems.

Recommended by 3 people across 3 different months, 2018 to 2020.

What it is

A short Python tutorial by sentdex, part of his Matplotlib series, showing how to build live-updating graphs with matplotlib's animation functionality. It reads from a changing data source and redraws the plot, with uses like live stock prices or sensor data.

What people said

Recommends BushLee · 2018-08 · Stack Overflow · on “Update matplotlib Pie in realtime”

Oh, in that case you are plotting a normal graph.You need to use matplotlib.animation for live graphs. He're a tutorial on live graphs : [this video]

Recommends ImportanceOfBeingErnest · 2018-10 · Stack Overflow · on “How do i make y-axis to be in an ascending order in matplotlib.animation? Sentdex tutorial”

There is this one [LINK] which actually does convert the strings to integers `xs.append(int(x))`. There is also this one [this video] where the first visible comment below the video tells you the solution.

Recommends Karthik · 2020-09 · Stack Overflow · on “Multiple different kinds of plots on a single figure and save it to a video”

@user1524182 I appologize that I wont be able to help you further regarding realtime `countour and imshow` plots. But regarding `line` plot, I would suggest you to take a look at this ** [this video] and ** [LINK] for animations using `matplotlib`. ..`Histogram` is also there in 2nd link, please check it.. I only know to achieve all your results using `google charts and chartJS` i.e. **to display in website realtime** .But with `matplotlib` I wont be able to help you further. **All the best**

Cites Sung Hoon Lee · 2019-05 · Stack Overflow · on “How to remove lines in a Matplotlib animation?”

I want remove the graph in animation, when the text line is more then 19 lines.. My code has referred to this video [this video] If the text line is more than 19 lines, the graph is remove. I was use the remove() and del , but this isn't working because using remove() and del in this code will not automatically delete the graph. When the text line is more than 19 lines, the graph remove when the matplotlib is re-executed. I also tried use plt.cla , plt.clf but this things.. removing the label too.. i don't want remove the label and title how can i fix it? . Here is my code : fig = plt.figure() ax1 = fig.add_subplot(1,1,1) plt.xlim(-190,190) plt.ylim(-190,190) def animate(i): graph_data = open('da