> ## Content Index
> Fetch the complete content index at: https://www.philsimon.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Sprucing Up Python Scripts With Data Visualization
- URL: https://www.philsimon.com/python-scripts-data-visualization/
- Published: 2019-04-21T14:53:15.000Z
- Updated: 2025-08-05T22:30:12.000Z
- Description: It doesn't take that much effort to visualize user-generated data.
- Author: Phil Simon
- Tags: Dataviz, Higher Education, ASU, Code, Python, Tableau, Teaching

Last fall, I taught four sections of [a survey course on information systems](https://www.philsimon.com/academia/courses/#236) to freshmen who have chosen not to study information systems. Still, regardless of major, [all students today benefit from knowing at least the basics of coding](https://www.philsimon.com/blog/higher-education/why-all-college-students-need-to-know-the-basics-of-coding/).

To this end, the other two instructors and I spend one class covering the basics of [object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented%5Fprogramming?ref=philsimon.com). (We coordinate our efforts to ensure consistency.) For the next three classes, we introduce simple programming concepts such as variables, print and [if-then-else](https://www.w3schools.com/python/python%5Fconditions.asp?ref=philsimon.com) statements, lists, functions, and *for* and *while loops*. In CIS236 and its cousin CIS235, we only scratch the surface of one of the today's most powerful and popular programming languages.

[![Coders](https://storage.ghost.io/c/8f/b5/8fb5e321-49a6-4cf5-8a28-c6f6d5417e54/content/images/2025/05/coders-1.jpg)](https://amzn.to/2XuQt6f?ref=philsimon.com)

At the end of the Python module, I stitch everything together with some examples that build upon what we have learned so far. My favorite is [a basketball-inspired one that pokes fun at my lack of skills](https://www.philsimon.com/class-memorable-basketball-inspired-python/). The script calculates my game-by-game and aggregate shooting percentages.

Although it's far beyond the scope of the class, there's so much more you can do with Python, especially when you consider its [libraries](https://tinyurl.com/y5en36n7?ref=philsimon.com). After reading Clive Thompson's excellent book [*Coders: The Making of a New Tribe and the Remaking of the World*](https://amzn.to/2XuQt6f?ref=philsimon.com), I thought that I'd revisit last semester's script and improve upon it.

## Improving on the First Iteration

I knew that I would first have to gather and store shot and game data in simple lists. (I use both game\_list and pct\_list in the code above.) After that, creating the bar chart would be pretty straightforward. I'm sure that I could have done it in many different ways, but I chose to visualize the results with [matplotlib.pyplot](https://matplotlib.org/api/%5Fas%5Fgen/matplotlib.pyplot.html?ref=philsimon.com) and [numpy](https://www.numpy.org/?ref=philsimon.com).

Give it a whirl yourself below by hitting the play button. Note that the bar chart appears at the bottom on the right. You'll most likely have to scroll down to see it.

*Click [here](https://github.com/philsimon/python%5Fdataviz?ref=philsimon.com) to download this script on my GitHub.*

Or, if you like, watch the video of it below:

[Dataviz, Data, and DevelopersExamining whether decisions today should begin and end with data.![](https://storage.ghost.io/c/8f/b5/8fb5e321-49a6-4cf5-8a28-c6f6d5417e54/content/images/icon/newlogo-2-84.png)Phil SimonPhil Simon![](https://storage.ghost.io/c/8f/b5/8fb5e321-49a6-4cf5-8a28-c6f6d5417e54/content/images/thumbnail/photo-1480843669328-3f7e37d196ae)](https://www.philsimon.com/dataviz-and-developers/)

## Simon Says

I'm hardly an expert on all things Python, but that's the point: It's not *that* hard to improve upon a script and, dare I say, add a little flair. Beyond that, I can think of worse ways to spend a few minutes on a Sunday morning than learning more about Python and some of its libraries.