Python Matplotlib Live Updating Graphs - part 1
Key Takeaways
Explains how to create live updating graphs in Python using Matplotlib's animation function
Full Transcript
hello and welcome to another matplotlib tutorial in this video I'm going to be teaching you all how to make live updating charts and graphs with in that plot live depending on what kind of work you do having a live updating charts and graphs can be pretty ideal and I know that whenever I'm stirring trying to figure out how to make this happen it was pretty much not taught by anyone so I had to go to the documentation to figure it out so at least for me what I was doing was trying to stream stock prices and then have it kind of change obviously with new prices but then you could also you can change more than just like the line right you can change everything in that whole figure so I made it so like the spines and the tick labels of the graph would change dynamically based on signals sent from a price or sentiment on my end so the lines basically around the chart right would change to green if you know there's a positive signal or change to red if there was a negative signal and so on so so it's obviously a bunch of uses that you can do not just have a line be live but also you can change the entire chart dynamically so pretty cool stuff so any way to do this the only thing that you really need is matplotlib I'm going to assume that most of you guys have map plot live already but if you don't I will link to the some windows binaries for Python extensions or you can go to matplotlib org and go to their download and download whatever version you need so if you have any issues downloading power matplotlib rather let me know I'm just going to assume most people watching this specific video probably already have matplotlib either coming through my series coming through their own stuff and finding it by you know typing and how to make live Python charts with matplotlib or you're coming from my charting tutorial either way you probably have it so I'm not going to waste your time with that so once you have matplotlib you should be all set I do suggest that you watch the other videos here with matplotlib but you can actually start this tutorial pretty fresh even if you have not ever used ma'am front lip so that will be okay and eventually what I'm going to do is tie this the live updating charts to our pre-existing charting in Python tutorial series so we'll pull live prices from Yahoo's API in the there are like five minute open high low close prices every every five minutes are updated so I'll show you guys how to do that and and then obviously you could if you have your own streaming prices you can tie it into wherever you have streaming prices so cool stuff ahead let's go ahead and get started probably the only thing I'm going to do in this video is show you guys the documentation for what we're going to do if you come over to matplotlib a mat lab is like that it's a it's a lot bigger than I think most people realize at least more than I realize it's kind of like Python you know you think you know a lot in Python until you start learning about all the stuff you don't know in Python anyway matplotlib org slash API slash and when you come here we're going to be interested in this animation function but you can't look through like all of this stuff there's all kinds of really cool stuff in here and each one has a bunch of stuff so like an animation we've got all this all these various things that you can do with an animation what we're interested in is passing a function through so if you just type in func you probably find it here we go what we're looking at is this animation dot func animation so this is going to let us do is pass a function through these this animation functionality within matplotlib so we're going to pass through a function that each time it's going to look for new prices if it finds them it will do that also within that same function we can do all of the stuff that we were talking about before like dynamically changing colors you can even have it dynamically change the zoom or I mean just anything right like you can put anything you want in that function so it's really really cool so that's what we're going to be doing obviously in here the only thing that we're really in you need will tell what figure will tell it the func in and that's pretty much it well so we're also going to have a refresh time in there and so on so anyway that's what we're going to be doing in the next video so if that sounds interesting stick around and we'll probably get out our first live updating chart in that next video so as always thanks for watching thank you for all the support the subscriptions and until next time
Original Description
A popular question is how to get live-updating graphs in Python and Matplotlib. Luckily for us, the creator of Matplotlib has even created something to help us do just that. This is the matplotlib.animation function. This video and the subsequent video shows you the animation function, how it works, and gives an example.
Sample code: http://pythonprogramming.net/basemap-python-plotting-tutorial-part-5/
Matplotlib playlist: http://www.youtube.com/watch?v=ge6DAaJ-leM&feature=share&list=PLQVvvaa0QuDfpEcGUM6ogsbrlWtqpS5-1&index=27
This video teaches you the basics of using Matplotlib's animation functionality in order to generate live updating charts and graphs within python. We will be later using this in conjunction with our stock charting tutorial series to make those stock price charts live updating.
Sentdex.com
Facebook.com/sentdex
Twitter.com/sentdex
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from sentdex · sentdex · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
Python Encryption Tutorial with PyCrypto
sentdex
Python's Logging Function
sentdex
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
wxPython Programming Tutorial 4: Panels
sentdex
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
wxPython Programming Tutorial 8: Custom Button Images
sentdex
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
Basic PHP Tutorial 12: Associative Array
sentdex
Basic PHP Tutorial 14: Foreach loop
sentdex
Basic PHP Tutorial 16: Include and Require
sentdex
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
Basic PHP Tutorial 4: Variables and Comments
sentdex
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
Basic PHP Tutorial 1: Intro to PHP
sentdex
Basic PHP Tutorial 3: HTML with PHP
sentdex
Basic PHP Tutorial 9: While Loop
sentdex
Basic PHP Tutorial 10: Switch Statement
sentdex
Basic PHP Tutorial 2: Print and Echo
sentdex
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
Basic PHP Tutorial 19: Finding words in strings
sentdex
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
Basic PHP Programming Tutorial 24: String similarity
sentdex
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
Sikuli Tutorial 1: Visually programming in python!
sentdex
Sikuli Tutorial 2: Program visually in python!
sentdex
Sikuli Tutorial 3: Program visually in python!
sentdex
3D Bar Charts in Python and Matplotlib
sentdex
3D Plane wire frame Graph Chart in Python
sentdex
Raspberry Pi Part 1 Introduction
sentdex
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
Raspberry Pi Part 11: Remote Desktop
sentdex
Twitter Analysis: How to rank a user's influence
sentdex
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex
🎓
Tutor Explanation
DeepCamp AI