The Matplotlib Python Module enables us to create visual charts using Python 3.
- In the previous section, we learned how to use data and OOP classes using Python 3. In this section, we will create beautiful charts using Python 3 with the Matplotlib module. Specifically, we'll look at creating beautiful charts using Matplotlib, downloading additional modules for Matplotlib. We'll then create our first chart, and then place labels on them. After that, we'll see how to give the chart a legend.
Finally, we'll go over scaling charts and adjusting the scale of charts dynamically. Let's dive right into creating beautiful charts that visually represent data. Depending on the format of the data source, we can plot one or several columns of data in the same chart, The Python Matplotlib module to create our charts. In order to create these graphical charts, we need to download additional Python modules, and there are several ways to install them.
Let's see what Matplotlib Python module has to offer. Matplotlib Python module enables us to create visual charts using Python 3. This URL is a great place to start exploring the world of Matplotlib. You can browse through a number of charts present here. We'll be focusing on a single chart for demonstration purposes. In order to use the Matplotlib Python module, we first have to install it, as well as several other related Python modules such as NumPy.
If you are running a version of Python less than 3.4.3, it would be great if you could upgrade your version of Python, as we will be using the Python pip module throughout this course to install the required Python modules, and pip is installed with 3.4.3 and above. It is possible to install pip with earlier versions of Python 3, but the process is not very intuitive so it is definitely better to upgrade to 3.4.3 or above.
Let's check which version we've installed. Open the command prompt and type "Python version". We have 3.4.3. Nice! Okay, moving on. The picture shown here is an example of what incredible graphical charts can be created using Python with the Matplotlib module. Let's see how it's done. I've copied the code from the Matplotlib.org website, which creates this incredible chart.
There are many examples available on this site, and I encourage you to try them out until you find the kind of charts you like to create. There you go! In less than 25 lines of Python code including white spaces, we now have the power to create amazing charts. Here's the output. Also, running the code using Python 3.4 or above with the Eclipse PyDev plugin might show some unresolved import errors.
This seems to be a bug in PyDev or Java. Just ignore those errors if you're developing using Eclipse, as the code will run successfully. In this video, we have learned how to create beautiful charts which the help of the Matplotlib website. In order to create beautiful graphs like this one, we need to install several other Python modules. We'll take a look at them in the next video, which would enable us to create our own beautiful charts.
See you soon!
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Creating buttons and widgets
- Adding labels and features
- Expanding a GUI dynamically
- Aligning frames and embedding frames
- Creating menu bars, message boxes, and tooltips
- Using module-level global variables
- Coding in classes
- Using Matplotlib to create charts
- Working with multiple threads, queues, and TCP/IP
- Using URLOpen to read data from websites
- Localizing a GUI and preparing for internationalization
- Testing a GUI using unit tests and Eclipse PyDev IDE
- Using the wxPython library
- Using Tkinter, PyOpenGL, and Pyglet
Skill Level Intermediate
1. Creating the GUI Form and Adding Widgets
2. Layout Management
3. Look and Feel Customization
4. Data and Classes
Using the StringVar() type8m 14s
5. Matplotlib Charts
6. Threads and Networking
7. Storing Data in Our MySQL Database via Our GUI
8. Internationalization and Testing
9. Extending Our GUI with the wxPython Library
10. Creating Amazing 3D GUIs with PyOpenGL and Pyglet
11. Best Practices
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.