From the course: Complete Guide to Advanced SQL Server

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Produce graphics with Matplotlib

Produce graphics with Matplotlib - SQL Server Tutorial

From the course: Complete Guide to Advanced SQL Server

Produce graphics with Matplotlib

The matplotlib package is a popular choice with Python programmers that want to export two dimensional charts and other data visualization graphics. It comes installed with the Anaconda distribution, so we can jump right in and start exporting graphics with a little Python code in SQL Server. In the WideWorldImporters database is a table called Application.Cities. Let's right click on it and choose Select top 1000 rows. Each city in this table has its own ID number, as well as the ID of the state or the province that it's in. I'm going to write a quick SELECT query to summarize this information. The result of this query is going to list out each state or province ID number here. And then we have a count of the number of cities in each one. Let's take this information and create a bar chart to visualize it, using a Python script that leverages the matplotlib library. I'm going to cut everything here to my clipboard, and then we'll start writing out the Python script. For the input data…

Contents