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

Поделиться
HTML-код
  • Опубликовано: 23 авг 2024

Комментарии • 348

  • @coreyms
    @coreyms  5 лет назад +96

    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:
    brilliant.org/cms

    • @ahmedhassanahmedhassan6495
      @ahmedhassanahmedhassan6495 5 лет назад

      waiting for subplots :)

    • @anonymous-kl1un
      @anonymous-kl1un 5 лет назад

      How many more to go in this series?

    • @coreyms
      @coreyms  5 лет назад +2

      @@ahmedhassanahmedhassan6495 Subplots tutorial will be released tomorrow morning

    • @coreyms
      @coreyms  5 лет назад +2

      @@anonymous-kl1un Tomorrow's video will be the last video for the time being. If I get many requests to cover topics that I didn't then I can continue adding to this series.

    • @m.s.1012
      @m.s.1012 5 лет назад

      you are doing great work,keep it up

  • @jnce96
    @jnce96 4 года назад +193

    For those using Jupyter Notebook, adding this line at the top of the notebook will make the graph appear:
    %matplotlib notebook

    • @matiascardone635
      @matiascardone635 4 года назад

      Thanks :D

    • @confidencechidiebere4509
      @confidencechidiebere4509 4 года назад +4

      Thank you John, I was struggling with this for two days and wondered why the graph is not showing. Why do we have to call "notebook"?

    • @visharadverma9903
      @visharadverma9903 4 года назад +4

      Dude thank you sm, you're a lifesaver!!!

    • @karthiavenger4577
      @karthiavenger4577 4 года назад

      Thank you sooo much bro but why notebook ??

    • @Am-hsb
      @Am-hsb 4 года назад

      Thanks a lot mate

  • @BiancaAguglia
    @BiancaAguglia 5 лет назад +91

    This was another great tutorial, Corey. And yes, please do a video about plotting real time data from an API. 😊 Thank you for all your hard work.

  • @Iknowpython
    @Iknowpython 5 лет назад +6

    One of the main reason why python is one of the best is because of its huge community contributing in creating libraries and matplotlib is definitely one of the finest library for data visualization

    • @nagabhushanr5599
      @nagabhushanr5599 4 года назад

      Hey I know python....can you tell me what is the importance of i in animate function
      I donno wat is passed through that parameter

  • @renujain8911
    @renujain8911 6 месяцев назад +1

    Whenever I got stuck then first channel I look for is Corey Schafer.... Your teaching style is something which no one seems to be matching.... So simple to understand any kind of difficult or complex topic.... Great Work :-)

  • @bokkenka
    @bokkenka 5 лет назад +16

    Nice videos. A tip for this one that might be useful: You can slice the data follow only the last X number of entries rather than seeing all the data bunch up tighter and tighter. Let's say you only care about the last minute... Add a `[-60:]` on the end of the `x=...`, `y1=...`, and `y2=...` lines.

    • @agustinbmed
      @agustinbmed 2 года назад

      oh dude, this info is great! thank you!

    • @diegoroy98
      @diegoroy98 2 года назад

      amazing. thanks for the tip. really helful

  • @alexandreperron4097
    @alexandreperron4097 3 года назад +2

    There is a special place in heaver for guys like you. Thank you so much. This is by far one of best things I saw on RUclips

  • @confidencechidiebere4509
    @confidencechidiebere4509 4 года назад +7

    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!

  • @clementstore
    @clementstore 5 лет назад +3

    Thank you very much. Your videos are better than most paid courses. That is a fair comment.

  • @mrmuranga
    @mrmuranga 4 года назад +2

    Corey, thanks...
    anyone who chose to use jupyter notebooks, incase your plots are not showing especially the live plots....and getting a mesg such as "figure size 432x288 with axes 0", would recommend you save the file you want to run as py file and then run it directly from the terminal....ensure though that in your terminal you have installed matplotlib and pandas via pip....

  • @youngzproduction7498
    @youngzproduction7498 5 лет назад +7

    I learn a lot from your vids. Literally, a lot. I hope you keep updating your tutorial more. This clip helps me understand how the plot updating itself. Thanks million times.

  • @ahmedyasser4350
    @ahmedyasser4350 5 лет назад +4

    Congrats on 300k, your videos are straight to the point and explained extremely well!

  • @ZsoltPal23092011
    @ZsoltPal23092011 Год назад +1

    Just simply love the idea in this video. Made it to a rolling (scrolling?) plot - if the data reaches 30+, it only plots the last 30, looks interesting. Thank you Corey, you are brilliant! Edit: changet it to 200 and added a try/except so that the plot can be started before the csv generation. I love this :) Thank you again Corey for this amazing video.

  • @ngkahing
    @ngkahing 3 года назад

    once again it so happens that when i search forrealtime plotting, it came up this great tutorial and only until in the mid of video that i found out its THE Corey Schafer - the better than paid courses Master Coach. Salute.

  • @SolvingOptimizationProblems
    @SolvingOptimizationProblems 4 года назад +1

    This is exactly what I'm looking for. It worked for me. Many thanks sir

  • @rutviktak716
    @rutviktak716 4 года назад +1

    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😊

    • @coreyms
      @coreyms  4 года назад

      That would be great!

  • @yash1152
    @yash1152 2 года назад

    16:48 > _"there's a way we'd've updated ... w/o clearing out the axis ... & just update the lines on the axis with live data"_
    thanks a lot for mentioning that clearly and not brushing it under the rug. i was thinking the same the whole time as clearing and redrawing all the data seems pretty inefficient to me

  • @matthijsgeerlings
    @matthijsgeerlings 3 года назад +8

    To make the graph appear when using spyder, add %matplotlib qt
    to the top of your file.

  • @luca-o-sharp
    @luca-o-sharp 2 года назад

    Awesome speaker, simple explanations, huge- huge thanks!!!

  • @chadbrubaker7994
    @chadbrubaker7994 5 месяцев назад

    Excellent video. Thanks so much for making this!

  • @woodziss3888
    @woodziss3888 5 лет назад +21

    Great video.
    Would be interesting to see how can one integrate this updating plot within a PyQT GUI.

  • @tireldenamse5854
    @tireldenamse5854 5 лет назад +1

    I really love this series!
    Thanks so much for your help!

  • @timstark6744
    @timstark6744 5 лет назад +1

    Great video Corey, thanks!

  • @KirillBezzubkine
    @KirillBezzubkine 4 года назад +1

    man you are awesome at showing and explaining

  • @kevingroovy8648
    @kevingroovy8648 3 года назад

    Dude you helped me out a lot!!! Thank you so much for taking the time to make this video. Subscribed to your channel

  • @madhankumar3687
    @madhankumar3687 5 лет назад +18

    Can you please make tutorials on opencv library.

  • @GiggsBeckham
    @GiggsBeckham 5 лет назад +2

    This is so COOL! I'm gonna try this at work tomorrow.

  • @arsenalfanism
    @arsenalfanism 4 года назад +9

    "Corey Schafer"

  • @saraghafelehbashi5808
    @saraghafelehbashi5808 2 года назад

    Thank you for saving our time

  • @saejfn
    @saejfn 2 года назад

    What a good explanation. Thanks

  • @swannschilling474
    @swannschilling474 3 года назад

    Great tutorial!! Just what I needed!!

  • @Nature-pb9dh
    @Nature-pb9dh 2 года назад

    Thanks man, this was really helpful.

  • @vishalmishra1937
    @vishalmishra1937 4 года назад

    No doubt why he is one of the best

  • @faqihmoch8639
    @faqihmoch8639 Год назад

    Thank you very much Sir, it means a lot to my project.

  • @TheSilvax
    @TheSilvax 9 месяцев назад

    great totorial, thank you!

  • @mnicp01
    @mnicp01 3 года назад

    fantastic explanation! thank you

  • @toothzombie
    @toothzombie 3 года назад

    Corey love your videos! Saved my butt a few times. Feedback: Can you show the end result of what you want to accomplish before jumping into the code? I know I can fast forward to the end...it just flows better IMO

  • @alexanderten5497
    @alexanderten5497 5 лет назад +3

    Great tutorial as well. You should teach in university. I wish you could be my professor

    • @ulfgj
      @ulfgj 5 лет назад

      he does. he is. this is youtube presenting us dr. cms.

  • @freeelectron8261
    @freeelectron8261 4 года назад

    Great tutorial! Thanks Corey! Just subscribed :)

  • @omzehn9872
    @omzehn9872 2 года назад

    thanks man! Really helpful video :)

  • @mallusreddy
    @mallusreddy 5 лет назад +1

    Wow it's really great video.. Thank you so much sir..

  • @Gndt1
    @Gndt1 8 месяцев назад

    Excellent video. Would be nice to show how to plot a scrolling window on the data, IE just show the last 'x' values.

  • @vantuantran225
    @vantuantran225 Год назад

    So cool, thanks you so much for the video 🥰

  • @vinayaksharma-ys3ip
    @vinayaksharma-ys3ip 2 года назад

    Great tut!!!

  • @chiragpalan9780
    @chiragpalan9780 3 года назад +1

    One question, what is 'i' inside function animate()??

  • @mohammadbasheer6192
    @mohammadbasheer6192 3 года назад

    thank you very much for this playlist sir, it was very helpful for me

  • @danielalegriasallo5551
    @danielalegriasallo5551 3 года назад

    After finishing this series I'm gonna watch your pandas tutorials

  • @IntegralDeLinha
    @IntegralDeLinha 2 года назад

    Great! Thanks for that!

  • @zakwan3169
    @zakwan3169 4 года назад +1

    great video sir

  • @slonbeskonechen8310
    @slonbeskonechen8310 3 года назад

    Great! Thank you!

  • @Deepsim
    @Deepsim 2 года назад

    Very clear tutorial

  • @stellarspacetraveler
    @stellarspacetraveler Год назад

    You can put a try-except in the animate function which will prevent the program from crashing before any data has been written to the data.csv file. That way you can start the data logging program before any data is generated.

  • @safari433_
    @safari433_ 4 года назад

    anixous for API class. This video was super helpfull. Thanks

  • @jimevega8113
    @jimevega8113 3 года назад

    thaank youuu! this save my final work today

  • @gnosis9266
    @gnosis9266 4 года назад +3

    The starting code is not working in jupyter notebook. I am simply getting a blank graph.

  • @VNnimbs
    @VNnimbs 4 года назад +2

    i'm getting this error

  • @francist3979
    @francist3979 5 лет назад +3

    Amazing Work!
    API PLEASE!!!

  • @alilo4943
    @alilo4943 4 года назад

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

  • @milnepe
    @milnepe 5 лет назад +2

    Matplotlib is a great series, thanks! How would you plot a fixed period, say like the last hour of data for a time series so it keeps rolling along?

  • @MamounMraish
    @MamounMraish Месяц назад

    Thank YOU!!!!!

  • @ahmdktr8050
    @ahmdktr8050 4 года назад

    that was helpful ,thank you

  • @mostafaelnady7827
    @mostafaelnady7827 5 лет назад +1

    really nice corey , but i have a dummy question why you not execute the function animate and also why you don't pass a value for the argument( i ) ?

  • @razahyder9796
    @razahyder9796 3 года назад +2

    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.

  • @pushpajitbiswas3752
    @pushpajitbiswas3752 5 лет назад +1

    Nice one 👍👍👍

  • @1CJK1
    @1CJK1 3 года назад

    Great!! Thanks!😁

  • @kantulaev
    @kantulaev 5 лет назад +3

    Go seaborn tutorial bro

  • @zeebay003
    @zeebay003 3 года назад

    Excellent

  • @amarbs3287
    @amarbs3287 5 лет назад +2

    Hi how to plot real time data such that only certain amount of samples are shown ... Here as time goes on the graph would have so many values

  • @meetpanchal4908
    @meetpanchal4908 Год назад +1

    1 Query !!
    If I want to plot the data that's not live but I want the effects like (The line is moving in upward or downward data)
    How can I plot it ? any suggestions ?

  • @ThePasupathi
    @ThePasupathi 5 лет назад +16

    Hi Corey, May i know the meaning of argument "i" in animate function?

    • @coreyms
      @coreyms  5 лет назад +9

      That is the interval. It’s something that is automatically passed in by the library

    • @mangoyumm
      @mangoyumm 4 года назад

      @@coreyms Can you explain this a bit more? Normally, an input argument is used in the definition of the function, but I see that is not the case here....however, when I try to run my code without "i", then the plot is empty, so it's obviously useful...?

    • @sudeeppatel7463
      @sudeeppatel7463 4 года назад +4

      @@mangoyumm Hey there, actually the "i" here refers to 'self' as you know that you need to pass the "self" parameter in python function is used to access arguments inside the function so now if you use self instead of "i" then you can see that the plot can be plotted and without it the function arguments are not accessed. I hope you find this helpful. Happy Coding. Also you can use anything instead of self .

    • @girardaquino
      @girardaquino 4 года назад

      @@sudeeppatel7463 would it have mattered if he just left it blank? In which case that would refer to self right?

    • @sudeeppatel7463
      @sudeeppatel7463 4 года назад +1

      Girard Aquino yes that’s by default in python but whenever you are calling a function in class you need to write self . Outside the class if you write self and then execute the program you will get a error stating “ required 1 argument but 2 were given or 2 argument 1 was given “ . But other than that it’s by default in python .Hope it helps

  • @abhinav9561
    @abhinav9561 3 года назад

    Thanks man!!

  • @archer_mkii
    @archer_mkii 3 года назад

    Thank you !

  • @johanknelsen4443
    @johanknelsen4443 5 лет назад +1

    Very nice video. It would be nice to have this display through a web server that could be made available on a local network.

  • @anantpatel5444
    @anantpatel5444 3 года назад +1

    message comes in consol and nothing gets plotted when i tried this code
    please help
    other than that your explanation is pretty good

  • @shoaibrain9894
    @shoaibrain9894 4 года назад +2

    How can we plot live data in the graph without saving it in the file?

  • @agustinbmed
    @agustinbmed 2 года назад +1

    this is wonderful, I really love your videos! I had a question for you tho... have you noticed a degradation in plotting after 1000+ data points? I'm running my tests in an old old system and running the data generator and the plot scripts at the same time causes my plot to plot ever so slowly... I gather it's the resources on my computer, but I'm thinking long term if I wanted to plot say a sensor with a "better" computer, will I have similar issues when acquiring this data? Thanks!

    • @dusk_r2069
      @dusk_r2069 Год назад

      Hi! I'm stuck with the exact same problem, did you find any work-around in these months?

  • @tonyomalle
    @tonyomalle 3 месяца назад

    I followed your teaching every step of the way, and I am experiencing difficulty.
    The csv file is created and data is written but with empty rows in-between.
    I believe these empty rows tend to trigger an error around the x-index whenever I plot the series.
    Would you be kind enough to proffer a solution to this?

  • @liangyumin9405
    @liangyumin9405 5 лет назад +1

    Great!

  • @markkennedy9767
    @markkennedy9767 9 месяцев назад

    Thank you. Couple of questions:
    What does the parameter i in the animate function refer to.
    What argument (if any) are we passing to this function when we call it.
    How is the animate function actually being called by what seems to be the animate argument for FuncAnimation.
    Why is the FuncAnimation function assigned to the variable Ani; We don't seem to use Ani anywhere else.
    Thanks

  • @ReflectingMe2024
    @ReflectingMe2024 2 года назад +1

    Excellent and very informative video Corey, thanks. May I ask is there a way to make the graph 'scroll' once a set number of data items have been reached. So say we always wanted to display the last 200 readings; rather than have the plot to continue to grow on the x axis, could we show the last 200 in a real-time plot?

  • @malayparmar504
    @malayparmar504 3 года назад +1

    Can you please tell why you add input argument 'i' in your animate function? I don't see any use of 'i'

  • @punjaramborhade1701
    @punjaramborhade1701 2 года назад

    U should have shown csv file, how values there n how it's plotting through code...
    Would be easy to understand..

  • @a_mortal7511
    @a_mortal7511 5 лет назад

    Thanks a dozen times, with the guide of your tutorial series "Python Django" I was able to build my first website in django.
    I wish you could do an API series with Django Rest Framework, I get really challenged when it comes to db modeling and normalization.

  • @amazing-graceolutomilayo5041
    @amazing-graceolutomilayo5041 5 лет назад +1

    Thank you sir

    • @syedmuslimjameel1792
      @syedmuslimjameel1792 4 года назад

      Somple random data graph is squeezing because previous values are not vanishing, still it show 0 as starting point.

  • @geektom8898
    @geektom8898 5 лет назад +1

    Hi Corey Schafer, please can you add a tutorial about account checker how its work and how we make it with python

  • @najibehnajafi9521
    @najibehnajafi9521 3 года назад

    if you are using Pycharm disable show plots in new tool window in python scientific to show plot

  • @TopicalAuthority
    @TopicalAuthority 4 года назад +4

    Anyone knows the meaning of '' ? I am using the default codes from Corey's github account.

    • @leocallebaut3548
      @leocallebaut3548 4 года назад +1

      if you're on jupyter notebook, use %matplotlib notebook at the top of your code. It should work fine.

    • @trishanag5232
      @trishanag5232 3 года назад +1

      @@leocallebaut3548 But it shows me blank figure

  • @tiktokaddict1965
    @tiktokaddict1965 4 года назад

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

  • @andrewh5640
    @andrewh5640 4 года назад

    Did you ever get around to making that video with the API? Would be great for real time stock prices for example

  • @nghiepcrypto7034
    @nghiepcrypto7034 4 года назад

    A nice video, and yes please do an API live plotting video. Maybe google analytics or RUclips ApI. I prefer RUclips Api. Thanks

  • @janwilmans
    @janwilmans 3 года назад

    very nice video, but if I understand correctly, you're reading the _whole_ csv file every second, not just new values, also re-plotting the whole series every update, would it be possible to read in the new lines and update the plot instead of re-creating it?

  • @robertcliffort2354
    @robertcliffort2354 2 года назад

    great.

  • @MrEstate
    @MrEstate 5 лет назад

    Great video series. Learned a lot not just about code but about the different types of graphics and there functions. How would you implement this with Django? I have data that would be nice to have other people in the company to see whenever they want too and would just have to hit a website to see it.

  • @JoCh911
    @JoCh911 4 года назад

    What an amazing content!!! I would like to bring those graphs on my website, have you made a video on that topic? Is it possible?

  • @chandrashekhar5874
    @chandrashekhar5874 4 года назад

    Hey Corey!
    Thank you for everything. Learnt a lot from your videos, could you post some videos on NLTK Module of python?
    Thanks again:)

  • @khalidjj2073
    @khalidjj2073 3 года назад

    Another nice video...
    This is so useful!
    I have a folder that gets xlsx files every 5minutes. Each xlsx has the same number of tabs and x and y columns.
    How can I realtime plot data as new csv's come in. Thanks

  • @hsan0184
    @hsan0184 3 года назад

    Thanks for great presentation. How can I do this with an existing pandas dataframe so to simulate data plot over time?

  • @mustafaalwash6952
    @mustafaalwash6952 2 года назад

    after you added your CSV file 11:28 why did you not remove the 'index=count()' there isn't any use for it anymore in the code right?

  • @tıbhendese
    @tıbhendese 2 года назад

    I am a beginner and I don't know how to get data from (cloud/online) database to process it and then plot it simultaneously. My data have to change very fast, for the project. How can I do this, do you know any tutorial? Thanks

  • @varunpanditpautra6982
    @varunpanditpautra6982 4 года назад

    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)?