Matplotlib Tutorial (Part 9): Plotting Live Data in Real-Time




[ad_1]

In this video, we will be learning how to plot live data in real-time using Matplotlib.

This video is sponsored by Brilliant. Go to https://brilliant.org/cms to sign up for free. Be one of the first 200 people to sign up with this link and get 20% off your premium subscription.

In this Python Programming video, we will be learning how to plot live data in real-time using Matplotlib. We will learn how to monitor a CSV file that is constantly being updated, and plot the values from that CSV file as they are coming in. This can be extremely useful for plotting data coming from APIs or sensors or any other source that will have frequent updates. Let’s get started…

The code from this video (with added logging) can be found at:
http://bit.ly/Matplotlib-09

✅ Support My Channel Through Patreon:
https://www.patreon.com/coreyms

✅ Become a Channel Member:
https://www.youtube.com/channel/UCCezIgC97PvUuR4_gbFUs5g/join

✅ One-Time Contribution Through PayPal:
https://goo.gl/649HFY

✅ Cryptocurrency Donations:
Bitcoin Wallet – 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet – 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet – MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey’s Public Amazon Wishlist
http://a.co/inIyro1

✅ Equipment I Use and Books I Recommend:
https://www.amazon.com/shop/coreyschafer

▶️ You Can Find Me On:
My Website – http://coreyms.com/
My Second Channel – https://www.youtube.com/c/coreymschafer
Facebook – https://www.facebook.com/CoreyMSchafer
Twitter – https://twitter.com/CoreyMSchafer
Instagram – https://www.instagram.com/coreymschafer/

#Python #Matplotlib

Source


[ad_2]

Comment List

  • Corey Schafer
    November 22, 2020

    I hope everyone finds this video helpful. The next video of the series will be posted tomorrow at the same time. The next video will cover subplots. Subplots are used to work with plots in a more object-oriented manner and also allow us to plot multiple different graphs at the same time.

    I'd like to thank Brilliant for sponsoring this series. If you'd like to check them out then you can sign up with this link and get 20% off your premium subscription:
    https://brilliant.org/cms

  • Corey Schafer
    November 22, 2020

    Are you at all familiar with the pyplot.ion() functionality? I am reading a book that I guess recommends that I use this piece of code as an interactive mode of plotting. I just wanted to know if there was a difference between this animate method or the pyplot.ion() method.

  • Corey Schafer
    November 22, 2020

    how i can put an image in the top of my line??

  • Corey Schafer
    November 22, 2020

    Hello. Is there any way to do this by scrolling rather than squishing?

  • Corey Schafer
    November 22, 2020

    Thank you !

  • Corey Schafer
    November 22, 2020

    this video is very helpful , meanwhile i wonder why official matplotlib.org 's documentations and examples are so awful

  • Corey Schafer
    November 22, 2020

    Thanks man!!

  • Corey Schafer
    November 22, 2020

    अयोध्या में प्लाट ले बहुत ही सस्ते मात्र 1 लाख के डाउन पेमेंट पर कॉल करे9369722618 , 8174963728

  • Corey Schafer
    November 22, 2020

    thanks for this masterpiece, however wondering how to update the most recent value on graph instead of plotting the whole graph again and again with the new values.

  • Corey Schafer
    November 22, 2020

    hello sir.. I try to plot the graph with the video input data as (x—-> time and y—-> input from video) like this..is that possible to plot using matplotlib and open cv python or else any other methods will be there

  • Corey Schafer
    November 22, 2020

    How would you plot the data from a binary file (i.e. non-ascii/binascii.unhexlify/csv)?

    For example, to support 8/16/24/32 bit data, I assume you would have to use bytearray/ord to construct each data elements from the byte(s), and save into an array of that data type?

    But how would you loop thru the file, grabbing 1,2,3 or 4 bytes to construct? int.from_bytes(b XXXXXX , byteorder='big', signed=false)? Is struct.pack needed?

  • Corey Schafer
    November 22, 2020

    When running a script like this, is it stable to just leave the task running or is it better to schedule the task to run in a cron or something like that?

  • Corey Schafer
    November 22, 2020

    Awesome! Could I do a live Time-series? (Update my time series as data comes in)

  • Corey Schafer
    November 22, 2020

    Hi corey, i have been following the tutorials rigorously , but in this tutorial i am unable to match the output.
    The output i am getting is '<Figure size 576×396 with 0 Axes>'

  • Corey Schafer
    November 22, 2020

    sir may i know how to plot graph from the video input (no of peoples come inside per sec under the surveylence camera)

  • Corey Schafer
    November 22, 2020

    Hi, I did NOT really understand the role of the variable 'i' in the function definition animation(i)?

  • Corey Schafer
    November 22, 2020

    No doubt why he is one of the best

  • Corey Schafer
    November 22, 2020

    hi, i tried to save the file using ani.save as an mp4 file, but the video is not playing. how do i solve this problem

  • Corey Schafer
    November 22, 2020

    Thanks again, but I got a problem ->
    from matplotlib.pyplot import FuncAnimation, I am getting module not found error, I am using jupiter notebook

  • Corey Schafer
    November 22, 2020

    My doubt is, I don't have a specific interval. When the data comes from API, I should be able to plot it. How can I do that?

  • Corey Schafer
    November 22, 2020

    How to do a different type of chart?
    Also, I have a main file with multiple imports on a bunch of sub files. How do I know what file this goes in?

  • Corey Schafer
    November 22, 2020

    Amazing video!
    I had a question – Is it possible to get Average of the live data and show that as annotation or a text on the graph (which keeps updating along with the graph)?

  • Corey Schafer
    November 22, 2020

    Thank you for making great tutorial,btw How to extract the animation into a video?

  • Corey Schafer
    November 22, 2020

    uuuh is there a way to make the x achis like pass thorugh the window so it doesnt get clttered up? or how to make seconds to like minuites in that x achis scaling thing?

  • Corey Schafer
    November 22, 2020

    When I'm doing live plotting it's gets overwritten by previous plots any clue what to do?

  • Corey Schafer
    November 22, 2020

    I AM LATE TO SEE THIS , but i have a question : can i plot live graph from a apk's web app page . . .

  • Corey Schafer
    November 22, 2020

    cool video. why didn't you use asyncio instead of using two separate programs ? thanks.

  • Corey Schafer
    November 22, 2020

    This is the toughest video in this series. I spent hours trying to figure it out but to no avail. I will pass and come back in the future. Perhaps by then, I would have gained more knowledge that will help me understand it. Excellent videos. Thank you!

  • Corey Schafer
    November 22, 2020

    Thank you, professional for your help😘😘😘🙏🙏

  • Corey Schafer
    November 22, 2020

    That's an another amazing tutorial!! But can somebody pls tell me why it dosen't work in Google Colab?

  • Corey Schafer
    November 22, 2020

    can someone explain why he created instance of FuncAnimation () named ani and never used it?

  • Corey Schafer
    November 22, 2020

    just have a question: currently I am able to write csv file, but how can I read the file while the csv is being written?

  • Corey Schafer
    November 22, 2020

    how to put the live data plot on web page using flask

  • Corey Schafer
    November 22, 2020

    Would be nice to have a linked github page so I could actually see what the CSV you're generating looks like.

  • Corey Schafer
    November 22, 2020

    Thanx mman,you'r helping lot of people.learned a lot from your channel and would like to pay it forward in the future just by sharing what i learned😊

  • Corey Schafer
    November 22, 2020

    So far everything was going all right. But in running this my output terminal is not showing any live figure but only showing
    <Figure size 432× 288 with 0 Axes>
    I am using Jupyter notebook to run my code.

  • Corey Schafer
    November 22, 2020

    I am getting error Data is not defined

  • Corey Schafer
    November 22, 2020

    I have a very similar setup like this for monitoring a couple of variables in a lab. However, I have noticed that over extended periods of time (5 hours) the figure started struggling to update, and I would get the "not responding" message at the top; eventually, the plot would generate, but since the plot was updating every minute, I saw the "not responding message" often. Not a serious issue, but eventually, I would like for the script to generate multiple plots and run for about a week's time, so I imagine my issues with the plot lagging will only be concentrated if I try to move forward.

    Any suggestions???

  • Corey Schafer
    November 22, 2020

    great video sir

Write a comment