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

description
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

detail
{'title': 'Matplotlib Tutorial (Part 9): Plotting Live Data in Real-Time', 'heatmap': [{'end': 214.393, 'start': 196.377, 'weight': 0.775}, {'end': 336.837, 'start': 252.711, 'weight': 0.984}, {'end': 399.137, 'start': 343.442, 'weight': 0.715}, {'end': 464.897, 'start': 425.061, 'weight': 0.85}, {'end': 547.751, 'start': 513.738, 'weight': 0.785}], 'summary': "Tutorial demonstrates real-time data plotting using matplotlib, explaining the process with python scripts and csv file examples, and covers real-time feedback, value updates, and creating live plots with python, offering a discount for the annual premium subscription for brilliant's python courses.", 'chapters': [{'end': 68.836, 'segs': [{'end': 25.883, 'src': 'embed', 'start': 0.209, 'weight': 0, 'content': [{'end': 5.592, 'text': "Hey there, how's it going everybody? In this video, we're going to be plotting data that's continuously being generated in real-time.", 'start': 0.209, 'duration': 5.383}, {'end': 10.755, 'text': 'So these real-time plots would be great for plotting data that is changing frequently that you want to monitor.', 'start': 6.012, 'duration': 4.743}, {'end': 18.379, 'text': 'So, for example, I see a lot of examples on certain sites that will plot things like real-time YouTube subscriber counts,', 'start': 11.075, 'duration': 7.304}, {'end': 22.141, 'text': "or maybe you're reading in data from a sensor and want that immediate feedback.", 'start': 18.379, 'duration': 3.762}, {'end': 25.883, 'text': "No matter what you're doing, you're likely going to find a use for something like this.", 'start': 22.661, 'duration': 3.222}], 'summary': 'Real-time plots useful for monitoring changing data, e.g. youtube subscriber counts or sensor feedback.', 'duration': 25.674, 'max_score': 0.209, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ209.jpg'}, {'end': 68.836, 'src': 'embed', 'start': 35.072, 'weight': 1, 'content': [{'end': 39.737, 'text': "And then we'll look at a real world example where we're actually monitoring a CSV file.", 'start': 35.072, 'duration': 4.665}, {'end': 47.704, 'text': "Now, if you're pulling data from a real time API or a sensor of some kind, then it's pretty common to write those results to a csv file.", 'start': 40.118, 'duration': 7.586}, {'end': 52.667, 'text': "so we'll monitor that for changes and make updates to our plot when there's new data available.", 'start': 47.704, 'duration': 4.963}, {'end': 57.93, 'text': 'now i would like to mention that we do have a sponsor for this series of videos and that is brilliant.org.', 'start': 52.667, 'duration': 5.263}, {'end': 66.134, 'text': 'so i really want to thank brilliant for sponsoring the series and it would be great if you all could check them out using the link in the description section below and support our sponsors,', 'start': 57.93, 'duration': 8.204}, {'end': 68.836, 'text': "and i'll talk more about their services in just a bit.", 'start': 66.134, 'duration': 2.702}], 'summary': 'Monitoring a csv file for changes and updates with real-time api data, sponsored by brilliant.org.', 'duration': 33.764, 'max_score': 35.072, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ35072.jpg'}], 'start': 0.209, 'title': 'Real-time data plotting', 'summary': 'Discusses the process of plotting real-time data, useful for monitoring frequently changing data like youtube subscriber counts or sensor readings, with examples of plotting data from a python script and monitoring a csv file for changes.', 'chapters': [{'end': 68.836, 'start': 0.209, 'title': 'Real-time data plotting', 'summary': 'Discusses the process of plotting real-time data, which is useful for monitoring frequently changing data like youtube subscriber counts or sensor readings, with examples of plotting data from a python script and monitoring a csv file for changes.', 'duration': 68.627, 'highlights': ['The chapter covers the process of plotting real-time data, useful for monitoring frequently changing data like YouTube subscriber counts or sensor readings.', 'Examples include plotting data from a Python script and monitoring a CSV file for changes.', 'Mentions sponsorship by brilliant.org and encourages viewers to support the sponsor by checking out their services.']}], 'duration': 68.627, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ209.jpg', 'highlights': ['The chapter covers the process of plotting real-time data, useful for monitoring frequently changing data like YouTube subscriber counts or sensor readings.', 'Examples include plotting data from a Python script and monitoring a CSV file for changes.', 'Mentions sponsorship by brilliant.org and encourages viewers to support the sponsor by checking out their services.']}, {'end': 195.997, 'segs': [{'end': 97.864, 'src': 'embed', 'start': 68.836, 'weight': 0, 'content': [{'end': 70.857, 'text': "so with that said, let's go ahead and get started.", 'start': 68.836, 'duration': 2.021}, {'end': 74.34, 'text': "Okay, so I've got some sample code pulled up here in my script.", 'start': 71.477, 'duration': 2.863}, {'end': 80.868, 'text': "So first, we'll look at these real time plots using this list of data directly in my script.", 'start': 74.721, 'duration': 6.147}, {'end': 85.673, 'text': "And then we'll look at a real world example with data that I'll load in from a CSV file.", 'start': 81.408, 'duration': 4.265}, {'end': 91.62, 'text': "Now, if you've been following along with the series, then you'll likely recognize the other matplotlib code that I have here at the moment.", 'start': 86.054, 'duration': 5.566}, {'end': 95.102, 'text': 'But if not, let me go over this real quick just in case.', 'start': 92.02, 'duration': 3.082}, {'end': 97.864, 'text': 'I have a few imports here at the top.', 'start': 96.023, 'duration': 1.841}], 'summary': 'Real-time plots and csv file example using sample code and matplotlib for data visualization.', 'duration': 29.028, 'max_score': 68.836, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ68836.jpg'}, {'end': 195.997, 'src': 'embed', 'start': 146.646, 'weight': 1, 'content': [{'end': 152.169, 'text': "Okay, so first off, we're used to using static plots that we've already seen in this series before.", 'start': 146.646, 'duration': 5.523}, {'end': 160.813, 'text': "So, for example, I have an X and a Y list here with values and I'm plotting this with the plt.plot method,", 'start': 152.589, 'duration': 8.224}, {'end': 163.274, 'text': 'which is just going to make a basic line chart.', 'start': 160.813, 'duration': 2.461}, {'end': 166.975, 'text': 'So if I run that, then we can see that works.', 'start': 163.594, 'duration': 3.381}, {'end': 168.596, 'text': 'So that is pretty simple.', 'start': 167.115, 'duration': 1.481}, {'end': 179.644, 'text': "but now let me delete the current data that we have in these lists and I'll uncomment out this function that I have right here and explain what our desired outcome is.", 'start': 169.096, 'duration': 10.548}, {'end': 195.997, 'text': "So let me remove plt.plot and for our x and y values I'm just going to set these to be empty lists and now let me uncomment out our index and our function here.", 'start': 180.045, 'duration': 15.952}], 'summary': 'Using plt.plot to create basic line chart with x and y lists. exploring empty data lists and functions.', 'duration': 49.351, 'max_score': 146.646, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ146646.jpg'}], 'start': 68.836, 'title': 'Real time plotting with matplotlib', 'summary': 'Demonstrates real time plotting using sample code in a script, including real world example with data from a csv file, and explains the process of plotting static plots and the desired outcome of using empty lists for x and y values.', 'chapters': [{'end': 195.997, 'start': 68.836, 'title': 'Real time plotting with matplotlib', 'summary': 'Demonstrates real time plotting using sample code in a script, including using real time plots and a real world example with data from a csv file, and explains the process of plotting static plots and the desired outcome of using empty lists for x and y values.', 'duration': 127.161, 'highlights': ['The chapter demonstrates real time plotting using sample code in a script, including using real time plots and a real world example with data from a CSV file.', 'The chapter explains the process of plotting static plots using X and Y lists with values and plt.plot method, which creates a basic line chart.', 'The chapter explains the desired outcome of using empty lists for x and y values.']}], 'duration': 127.161, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ68836.jpg', 'highlights': ['The chapter demonstrates real time plotting using sample code in a script, including using real time plots and a real world example with data from a CSV file.', 'The chapter explains the process of plotting static plots using X and Y lists with values and plt.plot method, which creates a basic line chart.', 'The chapter explains the desired outcome of using empty lists for x and y values.']}, {'end': 561.979, 'segs': [{'end': 248.669, 'src': 'heatmap', 'start': 196.377, 'weight': 0, 'content': [{'end': 200.701, 'text': 'So, for anyone who has never used the count function from the iter tools library,', 'start': 196.377, 'duration': 4.324}, {'end': 206.526, 'text': 'basically by default it just counts up one number at a time and each time we get the next value.', 'start': 200.701, 'duration': 5.825}, {'end': 214.393, 'text': 'So I have a function here called animate and within this function we are appending to our x values list.', 'start': 206.866, 'duration': 7.527}, {'end': 216.794, 'text': 'and also our y values list.', 'start': 214.853, 'duration': 1.941}, {'end': 223.017, 'text': 'Now x values is just going to append a value that is just going to count up by 1.', 'start': 217.094, 'duration': 5.923}, {'end': 224.538, 'text': "So it's just going to be sequential.", 'start': 223.017, 'duration': 1.521}, {'end': 232.922, 'text': 'And y values is appending a random number here between 1 and 5, or between 0 and 5.', 'start': 225.038, 'duration': 7.884}, {'end': 240.485, 'text': "So let's say that we wanted to run this function every second and plot these values that are getting appended to our list.", 'start': 232.922, 'duration': 7.563}, {'end': 248.669, 'text': 'Well, how would we do that? So to do that, we can use the funk animation class from the matplotlib animation module.', 'start': 241.146, 'duration': 7.523}], 'summary': 'Using itertools count function to generate sequential x values and random y values, and plotting with matplotlib animation.', 'duration': 52.292, 'max_score': 196.377, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ196377.jpg'}, {'end': 336.837, 'src': 'heatmap', 'start': 252.711, 'weight': 0.984, 'content': [{'end': 262.949, 'text': "So below our other imports here, I'm going to say from matplotlib.animation import func animation.", 'start': 252.711, 'duration': 10.238}, {'end': 268.674, 'text': 'And now down here below our function, let me make sure I spelled all that correctly.', 'start': 263.65, 'duration': 5.024}, {'end': 279.023, 'text': "Yep, So down here, below our animate function, let's tell matplotlib that we want to run that function on a specific interval,", 'start': 269.175, 'duration': 9.848}, {'end': 280.783, 'text': 'so we can plot that new data.', 'start': 279.023, 'duration': 1.76}, {'end': 288.986, 'text': "So to do this, I can simply say, create a variable called Annie, and I'll say Annie is equal to funk animation.", 'start': 281.183, 'duration': 7.803}, {'end': 291.426, 'text': 'And now we need to pass in a few arguments.', 'start': 289.486, 'duration': 1.94}, {'end': 295.388, 'text': 'So first, we need to pass in the figure that we want to animate.', 'start': 291.766, 'duration': 3.622}, {'end': 299.809, 'text': "Now. we'll learn more about figures in the next tutorial when we learn about subplots,", 'start': 295.748, 'duration': 4.061}, {'end': 303.851, 'text': 'But basically we just need to pass in the figure from our current plot.', 'start': 300.149, 'duration': 3.702}, {'end': 311.414, 'text': 'And to do that, we can just say plt.gcf, which is get current figure.', 'start': 304.271, 'duration': 7.143}, {'end': 317.197, 'text': 'OK And next, we need to pass in the function that we want to run for our animation.', 'start': 311.934, 'duration': 5.263}, {'end': 320.52, 'text': 'So that was the animate function.', 'start': 317.777, 'duration': 2.743}, {'end': 325.605, 'text': 'And also the interval for how often we want to run this function.', 'start': 321.261, 'duration': 4.344}, {'end': 327.628, 'text': 'The interval is in milliseconds.', 'start': 325.946, 'duration': 1.682}, {'end': 330.991, 'text': 'So if you want one second, then you can pass in 1000.', 'start': 327.788, 'duration': 3.203}, {'end': 336.837, 'text': 'And I think one second would be good for us in this video, but you can change that depending on your data.', 'start': 330.991, 'duration': 5.846}], 'summary': 'Using matplotlib to create an animation with specific interval and functions.', 'duration': 84.126, 'max_score': 252.711, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ252711.jpg'}, {'end': 327.628, 'src': 'embed', 'start': 300.149, 'weight': 1, 'content': [{'end': 303.851, 'text': 'But basically we just need to pass in the figure from our current plot.', 'start': 300.149, 'duration': 3.702}, {'end': 311.414, 'text': 'And to do that, we can just say plt.gcf, which is get current figure.', 'start': 304.271, 'duration': 7.143}, {'end': 317.197, 'text': 'OK And next, we need to pass in the function that we want to run for our animation.', 'start': 311.934, 'duration': 5.263}, {'end': 320.52, 'text': 'So that was the animate function.', 'start': 317.777, 'duration': 2.743}, {'end': 325.605, 'text': 'And also the interval for how often we want to run this function.', 'start': 321.261, 'duration': 4.344}, {'end': 327.628, 'text': 'The interval is in milliseconds.', 'start': 325.946, 'duration': 1.682}], 'summary': 'Pass current figure and function for animation with specified interval in milliseconds.', 'duration': 27.479, 'max_score': 300.149, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ300149.jpg'}, {'end': 399.137, 'src': 'heatmap', 'start': 343.442, 'weight': 0.715, 'content': [{'end': 351.585, 'text': "so now matplotlib is going to run this animate function every second, but currently we aren't plotting the data.", 'start': 343.442, 'duration': 8.143}, {'end': 356.327, 'text': "so within the animate function we're going to plot our X and our Y lists.", 'start': 351.585, 'duration': 4.742}, {'end': 365.993, 'text': "so I'm going to say plt.plot, and we will plot out those x values and we will also plot out those y values.", 'start': 356.327, 'duration': 9.666}, {'end': 371.777, 'text': "now, if we run it like this, then it will somewhat work, but there's going to be one big problem.", 'start': 365.993, 'duration': 5.784}, {'end': 374.819, 'text': "so let me run this and I'll show you what that problem is.", 'start': 371.777, 'duration': 3.042}, {'end': 381.023, 'text': 'so If we run this, we can see that we get an updating chart.', 'start': 374.819, 'duration': 6.204}, {'end': 383.645, 'text': 'But you can see here that this is weird.', 'start': 381.524, 'duration': 2.121}, {'end': 387.308, 'text': "We're getting all kinds of different colors here.", 'start': 383.665, 'duration': 3.643}, {'end': 392.132, 'text': "So let me close this, and I'll explain what's going on here.", 'start': 388.389, 'duration': 3.743}, {'end': 399.137, 'text': "So the reason it's doing that is because our plot method is actually plotting a brand new line every time.", 'start': 392.612, 'duration': 6.525}], 'summary': "Matplotlib's animate function updates chart, but creates new line each time.", 'duration': 55.695, 'max_score': 343.442, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ343442.jpg'}, {'end': 424.561, 'src': 'embed', 'start': 402.279, 'weight': 5, 'content': [{'end': 410.287, 'text': "So there are actually multiple lines getting stacked on top of each other there, but they're just being covered up so you can't really tell.", 'start': 402.279, 'duration': 8.008}, {'end': 414.271, 'text': 'So one way we could solve this is to simply clear out our axis.', 'start': 410.727, 'duration': 3.544}, {'end': 422.739, 'text': "And if we do that, then every time it plots that new line from scratch, we won't have that issue with the different colored lines,", 'start': 414.771, 'duration': 7.968}, {'end': 424.561, 'text': "because it's always going to plot the same color.", 'start': 422.739, 'duration': 1.822}], 'summary': 'Multiple lines getting stacked, clearing axis prevents issue with different colored lines.', 'duration': 22.282, 'max_score': 402.279, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ402279.jpg'}, {'end': 477.103, 'src': 'heatmap', 'start': 425.061, 'weight': 2, 'content': [{'end': 432.227, 'text': "so to clear the axis, we can simply run the cla method, which i'm assuming stands for clear axis.", 'start': 425.061, 'duration': 7.166}, {'end': 435.53, 'text': "so i'm going to put that right above our plot.", 'start': 432.227, 'duration': 3.303}, {'end': 439.874, 'text': "so i'm going to say plt, dot c, l a.", 'start': 435.53, 'duration': 4.344}, {'end': 446.12, 'text': 'and now, if i run this, then we can see that this looks better.', 'start': 439.874, 'duration': 6.246}, {'end': 450.724, 'text': "it's updating our plot with those random values each time.", 'start': 446.12, 'duration': 4.604}, {'end': 454.127, 'text': "our animate function is run okay, so that's nice.", 'start': 450.724, 'duration': 3.403}, {'end': 464.897, 'text': "but using random data directly within our animate function doesn't really give us an idea of how this would help us plot real world data that's coming from an outside source.", 'start': 454.127, 'duration': 10.77}, {'end': 468.12, 'text': "so let's take a look at how we would do that.", 'start': 464.897, 'duration': 3.223}, {'end': 477.103, 'text': "So to do this, I'm going to plot data that's from a CSV, and this CSV is going to be constantly updated by an outside source.", 'start': 468.76, 'duration': 8.343}], 'summary': 'Using plt.cla to clear the axis and plotting real world data from a constantly updated csv file.', 'duration': 22.976, 'max_score': 425.061, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ425061.jpg'}, {'end': 547.751, 'src': 'heatmap', 'start': 513.738, 'weight': 0.785, 'content': [{'end': 519.84, 'text': "So let me go over this really quick and show how I'm writing random data to a CSV file in real time.", 'start': 513.738, 'duration': 6.102}, {'end': 523.181, 'text': "So I'm importing the CSV module random and time.", 'start': 520.2, 'duration': 2.981}, {'end': 529.042, 'text': "We're setting some starting values here of zero and then total one and total two equal to a thousand.", 'start': 523.701, 'duration': 5.341}, {'end': 532.563, 'text': "And then we're just using the built in CSV module for this stuff.", 'start': 529.482, 'duration': 3.081}, {'end': 536.164, 'text': 'So the field names here are going to be the headers for the CSV file.', 'start': 532.903, 'duration': 3.261}, {'end': 539.226, 'text': 'We are opening that up and writing those headers.', 'start': 536.924, 'duration': 2.302}, {'end': 547.751, 'text': "And then we're saying while true, so this is just going to continuously run, we are opening up that data in append mode.", 'start': 539.746, 'duration': 8.005}], 'summary': 'Writing random data to csv in real time, using csv module for continuous operation.', 'duration': 34.013, 'max_score': 513.738, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ513738.jpg'}], 'start': 196.377, 'title': 'Real-time plotting with matplotlib', 'summary': 'Explains the usage of count function and funk animation class from itertools library, plotting data with func animation module from matplotlib, and real-time plotting in python including real-world data from a csv file.', 'chapters': [{'end': 248.669, 'start': 196.377, 'title': 'Using count function and funk animation class', 'summary': 'Explains the usage of the count function from the iter tools library to count up one number at a time and the implementation of the animate function to append sequential x values and random y values, followed by the use of the funk animation class from the matplotlib animation module to run the function every second and plot the values.', 'duration': 52.292, 'highlights': ['The chapter explains the usage of the count function from the iter tools library to count up one number at a time. The count function from the iter tools library is used to count up one number at a time.', 'The implementation of the animate function to append sequential x values and random y values. The animate function appends sequential x values and random y values to the lists.', 'The use of the funk animation class from the matplotlib animation module to run the function every second and plot the values. The funk animation class from the matplotlib animation module is used to run the function every second and plot the values.']}, {'end': 351.585, 'start': 249.009, 'title': 'Plotting data with matplotlib', 'summary': 'Discusses how to use the func animation module from matplotlib to create an animation, specifying the figure to animate, the function to run, and the interval in milliseconds, with a recommendation of 1 second.', 'duration': 102.576, 'highlights': ['The chapter explains how to use the func animation module from matplotlib to create an animation, specifying the figure to animate, the function to run, and the interval in milliseconds, recommending 1 second for the interval (1000 milliseconds).', 'The chapter demonstrates the use of plt.gcf to get the current figure for the animation process.', 'The chapter emphasizes the importance of specifying the interval in milliseconds for the animation, with a recommendation of 1 second (1000 milliseconds).']}, {'end': 561.979, 'start': 351.585, 'title': 'Real-time plotting with python', 'summary': 'Demonstrates real-time plotting in python using matplotlib, highlighting the issue of multiple lines getting stacked on top of each other and the approach to solve it by clearing the axis, while also discussing plotting real-world data from a csv file and continuously updating it from an outside source.', 'duration': 210.394, 'highlights': ['The issue of multiple lines getting stacked on top of each other is highlighted, and the approach to solve it by clearing the axis is explained. The plot method is actually plotting a brand new line every time without clearing out the old lines, resulting in multiple lines getting stacked on top of each other, which can be solved by clearing the axis using the cla method.', 'The demonstration of plotting real-world data from a CSV file and continuously updating it from an outside source is explained. The source for the CSV data is a simple Python script that continuously adds values, demonstrating how to plot data from an outside source and discussing common sources for CSV data such as online APIs and sensor data.']}], 'duration': 365.602, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ196377.jpg', 'highlights': ['The chapter explains the usage of the count function from the iter tools library to count up one number at a time.', 'The chapter demonstrates the use of plt.gcf to get the current figure for the animation process.', 'The demonstration of plotting real-world data from a CSV file and continuously updating it from an outside source is explained.', 'The use of the funk animation class from the matplotlib animation module to run the function every second and plot the values.', 'The chapter explains how to use the func animation module from matplotlib to create an animation, specifying the figure to animate, the function to run, and the interval in milliseconds, recommending 1 second for the interval (1000 milliseconds).', 'The issue of multiple lines getting stacked on top of each other is highlighted, and the approach to solve it by clearing the axis is explained.']}, {'end': 946.242, 'segs': [{'end': 609.056, 'src': 'embed', 'start': 562.379, 'weight': 0, 'content': [{'end': 567.321, 'text': "And then we're also printing this out to the console so that we can get some real time feedback in the console as well.", 'start': 562.379, 'duration': 4.942}, {'end': 570.223, 'text': "And then lastly, we're updating the values.", 'start': 567.782, 'duration': 2.441}, {'end': 574.104, 'text': "So I'm just incrementing my x values by one every time.", 'start': 570.523, 'duration': 3.581}, {'end': 576.325, 'text': 'Now your x values could be anything.', 'start': 574.665, 'duration': 1.66}, {'end': 577.426, 'text': 'They could be dates.', 'start': 576.365, 'duration': 1.061}, {'end': 579.787, 'text': 'They could be anything.', 'start': 577.486, 'duration': 2.301}, {'end': 582.228, 'text': 'And now for total one.', 'start': 580.787, 'duration': 1.441}, {'end': 590.738, 'text': 'we are saying total one is equal to its old value, plus a random integer between negative six and eight.', 'start': 582.648, 'duration': 8.09}, {'end': 592.42, 'text': 'so i just wanted some variation there.', 'start': 590.738, 'duration': 1.682}, {'end': 596.905, 'text': "it can either go down or it can go up, but it's got a better chance of going up.", 'start': 592.42, 'duration': 4.485}, {'end': 604.332, 'text': "total two is equal to total two's old value at plus or minus, negative five to six.", 'start': 596.905, 'duration': 7.427}, {'end': 609.056, 'text': "So it can also go down or up, but it's more likely to go up as well.", 'start': 604.652, 'duration': 4.404}], 'summary': 'Updating x values and total one and two with random integers.', 'duration': 46.677, 'max_score': 562.379, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ562379.jpg'}, {'end': 750.759, 'src': 'embed', 'start': 719.731, 'weight': 4, 'content': [{'end': 725.233, 'text': "YouTube subscriber counts and we're plotting the live counts of two different channels or something like that.", 'start': 719.731, 'duration': 5.502}, {'end': 728.854, 'text': 'So below our clear axis.', 'start': 726.013, 'duration': 2.841}, {'end': 731.797, 'text': "there I'm going to plot out.", 'start': 728.854, 'duration': 2.943}, {'end': 743.094, 'text': "first I'm gonna plot out our y1, so pass in x for our x-axis, y1 for our y-axis, then I'm gonna give this a label and I'll just call this channel 1.", 'start': 731.797, 'duration': 11.297}, {'end': 750.759, 'text': "and now I'm gonna copy this and also plot out a line for y2, and I will call this channel2..", 'start': 743.094, 'duration': 7.665}], 'summary': 'Plotting live youtube subscriber counts for two channels.', 'duration': 31.028, 'max_score': 719.731, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ719731.jpg'}, {'end': 870.694, 'src': 'embed', 'start': 841.182, 'weight': 1, 'content': [{'end': 843.663, 'text': 'And when I run that, it creates that CSV file.', 'start': 841.182, 'duration': 2.481}, {'end': 846.444, 'text': 'And now this is writing data to that CSV file.', 'start': 844.043, 'duration': 2.401}, {'end': 849.725, 'text': "And it's going to continue as long as we don't kill our operation here.", 'start': 846.524, 'duration': 3.201}, {'end': 856.367, 'text': 'So if we go back to our script, now that CSV is being updated with live data.', 'start': 850.185, 'duration': 6.182}, {'end': 861.048, 'text': "So let's go to the script and see if this is picking up those real time changes.", 'start': 856.747, 'duration': 4.301}, {'end': 863.289, 'text': "So I'm going to run our code here.", 'start': 861.348, 'duration': 1.941}, {'end': 870.694, 'text': "And when I run this, you can see that that's already been running for some time and that these have already taken off.", 'start': 863.809, 'duration': 6.885}], 'summary': 'The script updates a csv file with live data and detects real-time changes.', 'duration': 29.512, 'max_score': 841.182, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ841182.jpg'}], 'start': 562.379, 'title': 'Real-time data monitoring', 'summary': 'Covers real-time feedback and value updates, including x values being incremented and total values updated with random integers, as well as monitoring live data from a csv file using python, updating data every second, and plotting it in real time.', 'chapters': [{'end': 609.056, 'start': 562.379, 'title': 'Real-time feedback and value updates', 'summary': 'Discusses real-time feedback in the console and updating values, with x values being incremented by one and total values being updated with random integers between a specified range, with a higher chance of going up.', 'duration': 46.677, 'highlights': ['The chapter discusses updating values, with x values being incremented by one every time.', 'Real-time feedback in the console is mentioned as a way to get real-time feedback during the process.', 'Total values are updated with random integers between specified ranges, with a higher likelihood of going up.']}, {'end': 946.242, 'start': 609.196, 'title': 'Real-time data monitoring with python', 'summary': 'Discusses the process of monitoring live data from a csv file using python, updating the data every second, and plotting it in real time, while also considering the need to specify the legend location and layout for better visualization.', 'duration': 337.046, 'highlights': ['The script reads in live data from a CSV file and updates it every second, enabling real-time monitoring of the data.', 'The process involves plotting live data from the CSV file, with the example of monitoring YouTube subscriber counts for two different channels.', 'Consideration is given to specifying the location of the legend and implementing tight layout for better visualization, addressing the potential issue of the legend switching spots due to constantly updating data.']}], 'duration': 383.863, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ562379.jpg', 'highlights': ['Real-time feedback in the console is mentioned as a way to get real-time feedback during the process.', 'The script reads in live data from a CSV file and updates it every second, enabling real-time monitoring of the data.', 'The chapter discusses updating values, with x values being incremented by one every time.', 'Total values are updated with random integers between specified ranges, with a higher likelihood of going up.', 'The process involves plotting live data from the CSV file, with the example of monitoring YouTube subscriber counts for two different channels.']}, {'end': 1221.116, 'segs': [{'end': 1037.636, 'src': 'embed', 'start': 946.547, 'weight': 0, 'content': [{'end': 950.228, 'text': "and it was behind for the longest time and now it's just constantly been going up.", 'start': 946.547, 'duration': 3.681}, {'end': 956.891, 'text': "Okay, so we can close this down, but it's kind of fun to watch these live plots take off like this.", 'start': 950.589, 'duration': 6.302}, {'end': 964.894, 'text': "So this was a pretty basic animation that we put together here using this live data, but there's a lot more that you can do depending on your needs.", 'start': 957.511, 'duration': 7.383}, {'end': 974.02, 'text': 'So for example, if you needed to run an initialize function for your animation, that sets things up one time before your animation first runs.', 'start': 965.194, 'duration': 8.826}, {'end': 982.166, 'text': 'And then to do that, the func animation class has an init func argument that you could pass in to do that.', 'start': 974.3, 'duration': 7.866}, {'end': 991.014, 'text': 'Or if you needed to pass in additional arguments to our animate function, then our function, The funk animation class,', 'start': 982.887, 'duration': 8.127}, {'end': 993.637, 'text': 'also has an F args argument to do that.', 'start': 991.014, 'duration': 2.623}, {'end': 999.103, 'text': "So there's a lot more that you can do with this and some of these animations can get pretty complex.", 'start': 994.017, 'duration': 5.086}, {'end': 1005.971, 'text': "I've seen some people use these for drawings and math simulations and gravity simulations and all kinds of neat stuff.", 'start': 999.183, 'duration': 6.788}, {'end': 1014.159, 'text': 'now there is a way that we could have updated our plot without totally clearing out the axis, but it takes a bit more code,', 'start': 1006.391, 'duration': 7.768}, {'end': 1019.324, 'text': "since we'd have to also manually check our x and y limits and things like that.", 'start': 1014.159, 'duration': 5.165}, {'end': 1026.97, 'text': 'but it is possible to not clear out our axis here and just update the lines on the axis with the live data.', 'start': 1019.324, 'duration': 7.646}, {'end': 1029.732, 'text': "So there's more than one way to do things like this.", 'start': 1027.349, 'duration': 2.383}, {'end': 1034.214, 'text': 'But I thought that this was good enough for this video.', 'start': 1030.551, 'duration': 3.663}, {'end': 1037.636, 'text': 'I think that this works well with the amount of data that we were looking at.', 'start': 1034.253, 'duration': 3.383}], 'summary': 'Live plots constantly going up, basic animation with live data, more options for customization.', 'duration': 91.089, 'max_score': 946.547, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ946547.jpg'}, {'end': 1129.737, 'src': 'embed', 'start': 1103.038, 'weight': 3, 'content': [{'end': 1108.904, 'text': 'They even use Python in their statistics courses and will quiz you on how to correctly analyze the data within the language.', 'start': 1103.038, 'duration': 5.866}, {'end': 1114.649, 'text': 'Their guided lessons will challenge you, but you also have the ability to get hints or even solutions if you need them.', 'start': 1109.224, 'duration': 5.425}, {'end': 1117.552, 'text': "It's really tailored towards understanding the material.", 'start': 1115.049, 'duration': 2.503}, {'end': 1120.815, 'text': "They've also recently released a programming with Python course.", 'start': 1117.852, 'duration': 2.963}, {'end': 1126.916, 'text': 'and they even have a coding environment built into their website so that you can run code directly in the browser,', 'start': 1121.175, 'duration': 5.741}, {'end': 1129.737, 'text': 'and that is a great way to complement watching my tutorials,', 'start': 1126.916, 'duration': 2.821}], 'summary': 'Python used in statistics courses, provides guided lessons with coding environment integrated into the website.', 'duration': 26.699, 'max_score': 1103.038, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ1103038.jpg'}, {'end': 1164.785, 'src': 'embed', 'start': 1135.938, 'weight': 7, 'content': [{'end': 1143.039, 'text': 'so to support my channel and learn more about brilliant, you can go to brilliant.org, forward slash cms to sign up for free,', 'start': 1135.938, 'duration': 7.101}, {'end': 1148.48, 'text': 'and also the first 200 people that go to that link will get 20 off the annual premium subscription,', 'start': 1143.039, 'duration': 5.441}, {'end': 1151.241, 'text': 'And you can find that link in the description section below.', 'start': 1148.88, 'duration': 2.361}, {'end': 1155.942, 'text': "Again, that's brilliant.org forward slash CMS.", 'start': 1151.681, 'duration': 4.261}, {'end': 1158.643, 'text': 'Okay, so I think that is going to do it for this video.', 'start': 1156.702, 'duration': 1.941}, {'end': 1164.785, 'text': 'I hope you feel like you got a good idea for how these animations work and how you can use that to plot real-time data.', 'start': 1158.963, 'duration': 5.822}], 'summary': 'Visit brilliant.org/cms for free sign up and 20% off annual premium subscription for first 200 people.', 'duration': 28.847, 'max_score': 1135.938, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ1135938.jpg'}, {'end': 1206.773, 'src': 'embed', 'start': 1180.368, 'weight': 4, 'content': [{'end': 1187.429, 'text': "So, so far in this series, we've simply been creating our plots with the PyPlot object, and that works great for what we've done so far.", 'start': 1180.368, 'duration': 7.061}, {'end': 1193.53, 'text': "But if you want additional plots or subplots, then it's best to create your plots with the subplots method.", 'start': 1187.809, 'duration': 5.721}, {'end': 1195.931, 'text': 'So definitely be sure to check out that video.', 'start': 1193.851, 'duration': 2.08}, {'end': 1201.572, 'text': 'But if anyone has any questions about what we covered in this video, then feel free to ask in the comments section below,', 'start': 1196.491, 'duration': 5.081}, {'end': 1202.752, 'text': "and I'll do my best to answer those.", 'start': 1201.572, 'duration': 1.18}, {'end': 1206.773, 'text': 'And if you enjoy these tutorials and would like to support them, then there are several ways you can do that.', 'start': 1203.052, 'duration': 3.721}], 'summary': 'Create plots with pyplot, use subplots method for additional plots or subplots. check out the video for more details.', 'duration': 26.405, 'max_score': 1180.368, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ1180368.jpg'}, {'end': 1221.116, 'src': 'embed', 'start': 1209.874, 'weight': 5, 'content': [{'end': 1213.154, 'text': "And also, it's a huge help to share these videos with anyone who you think would find them useful.", 'start': 1209.874, 'duration': 3.28}, {'end': 1217.855, 'text': "And if you have the means, you can contribute through Patreon and there's a link to that page in the description section below.", 'start': 1213.514, 'duration': 4.341}, {'end': 1221.116, 'text': 'Be sure to subscribe for future videos and thank you all for watching.', 'start': 1218.315, 'duration': 2.801}], 'summary': 'Encouraging sharing of videos, seeking contributions through patreon, and expressing gratitude for viewership.', 'duration': 11.242, 'max_score': 1209.874, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ1209874.jpg'}], 'start': 946.547, 'title': 'Creating live plots with python and matplotlib partnership', 'summary': 'Covers creating live plots with python, including real-time data updates and animations, and the partnership between matplotlib and brilliant, featuring hands-on courses in python and offering a discount for the annual premium subscription. it also emphasizes audience interaction and support for the tutorials.', 'chapters': [{'end': 1085.049, 'start': 946.547, 'title': 'Creating live plots with python', 'summary': 'Explains the process of creating live plots using python, demonstrating how to update and animate data in real-time while discussing additional functionalities and potential applications, such as manual updating and initialization functions.', 'duration': 138.502, 'highlights': ['The process of creating live plots using Python is demonstrated, showcasing the continuous updating of data with over 200 seconds of recorded information.', 'Additional functionalities of the animation class in Python, such as the init func argument for one-time setup and the F args argument for passing additional parameters, are discussed.', 'Potential applications of live plots are mentioned, including drawings, math simulations, and gravity simulations, highlighting the versatility and complexity of the animations.', 'Manual updating methods for plots without clearing the axis are briefly mentioned, indicating alternative approaches to updating live plots.', 'The sponsorship of the video by Brilliant.org is mentioned, providing further context on the content and potential resources related to the topic.']}, {'end': 1221.116, 'start': 1086.169, 'title': 'Matplotlib and brilliant partnership', 'summary': "Discusses the partnership between matplotlib and brilliant, highlighting brilliant's hands-on courses in python, statistics, and programming, and offering a discount for the annual premium subscription. the chapter also introduces the upcoming video on subplots and emphasizes audience interaction and support for the tutorials.", 'duration': 134.947, 'highlights': ['Brilliant offers hands-on courses covering Python, statistics, and programming, with the ability to run code directly in the browser and a discount of 20 off the annual premium subscription for the first 200 sign-ups.', 'Introduction of the upcoming video on subplots, emphasizing the importance of creating plots with the subplots method for additional plots or subplots.', 'Encouragement for audience interaction and support through liking, sharing, and contributing through Patreon, underlining the importance of subscriber support for future videos.']}], 'duration': 274.569, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Ercd-Ip5PfQ/pics/Ercd-Ip5PfQ946547.jpg', 'highlights': ['The process of creating live plots using Python is demonstrated, showcasing the continuous updating of data with over 200 seconds of recorded information.', 'Additional functionalities of the animation class in Python, such as the init func argument for one-time setup and the F args argument for passing additional parameters, are discussed.', 'Potential applications of live plots are mentioned, including drawings, math simulations, and gravity simulations, highlighting the versatility and complexity of the animations.', 'Brilliant offers hands-on courses covering Python, statistics, and programming, with the ability to run code directly in the browser and a discount of 20 off the annual premium subscription for the first 200 sign-ups.', 'Introduction of the upcoming video on subplots, emphasizing the importance of creating plots with the subplots method for additional plots or subplots.', 'Encouragement for audience interaction and support through liking, sharing, and contributing through Patreon, underlining the importance of subscriber support for future videos.', 'Manual updating methods for plots without clearing the axis are briefly mentioned, indicating alternative approaches to updating live plots.', 'The sponsorship of the video by Brilliant.org is mentioned, providing further context on the content and potential resources related to the topic.']}], 'highlights': ['The chapter explains the process of plotting real-time data, useful for monitoring frequently changing data like YouTube subscriber counts or sensor readings.', 'The chapter demonstrates real time plotting using sample code in a script, including using real time plots and a real world example with data from a CSV file.', 'The chapter explains the usage of the count function from the iter tools library to count up one number at a time.', 'Real-time feedback in the console is mentioned as a way to get real-time feedback during the process.', 'The process of creating live plots using Python is demonstrated, showcasing the continuous updating of data with over 200 seconds of recorded information.']}