O'Reilly logo

Matplotlib 2.x By Example by Aldrin Yim, Claire Chung, Allen Yu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tkinter-based backend 

Let's try to copy the following code to a separate text file and name it chapter6_gui.py. After that, type python chapter6_gui.py in your terminal (Mac/Linux) or Command Prompt (Windows). If you are unsure about how to open a terminal or Command Prompt, refer to Chapter 1, Hello Plotting World!, for more details:

import matplotlibimport matplotlib.pyplot as pltimport textwrap # Standard library for text wrapingimport requestsimport pandas as pdfrom bs4 import BeautifulSoup# Specify the urlurl = "https://www.bls.gov/emp/ep_table_001.htm"# Query the website and get the html responseresponse = requests.get(url)# Parse the returned html using BeautifulSoupbs = BeautifulSoup(response.text)# Select the table header by CSS ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required