Menu Sidebar

How to Create Pitch Charts with Python

A guest post by Gregory Brunner

I have been interested in looking at MLB pitch data and play-by-play for a while now, however, I have not found any good blob posts or tutorials for doing this. So during the MLB Playoffs, while I was checking the score of Cubs vs. Dodgers, Game 5 on Yahoo! it struck me that there is probably a way to get the live game data from Yahoo! while the game is in progress. So I poked around and found that there is! In this post, I will review what I found and how to use the data to make pitch charts using the data from World Series Game 7.

OKSCAUG, Thunder Up!

By Gregory Brunner

I was supposed to be at OKSCAUG in Moore, Oklahoma on Tuesday presenting on Mapping Russell Westbrook’s Shots with Python and ArcGIS; however, on Friday I fell through my garage ceiling and injured my left wrist, elbow, shoulder, and hip. Here’s the hole I left in the ceiling:


It was a 10 or 12 foot fall. Amazingly Miraculously, the x-rays taken at the ER show no broken or separated bones! Still, I have limited range of motion in my left arm and left hip and a lot of pain in my left arm.

For OKSCAUG I was asked to give a short 10-15 minute overview during the morning and a longer technical session in the afternoon. Below, I have linked to the presentations.

Here is the short version:


Go To Story Map

Here is the long version:


Go To Story Map

If you are a basketball fan, check them out. They were really fun presentations to put together.

I am sorry I couldn’t be there with you in Moore, Oklahoma today. I hope you can understand.

Team Basemaps

Team Basemaps is a web app that allows you to choose your favorite team, cycle through the team colors to get the map looking exactly like you want, and then save it to your ArcGIS Online account to use in maps. It uses the Vector Tile Layers in combination with the new ArcGIS JavaScript API 4.0.


I’d love to see your favorite basemap color combinations – post them in the comments!

Some information on how I created this is over on GeoNet.

Release Your New Web AppBuilder Widget in Four Steps

So you just wrote a great Web AppBuilder widget, and want to release it to the world so everyone can benefit.

Create the Widget

First create your widget, preferably using the generator-esri-appbuilder-js Yeoman Generator. That way your settings will be correct, your manifest.json file will be filled out, and your files will be in a great structure, optimized for GitHub. Speaking of which …

Upload to GitHub

Upload the file structure to a new GitHub repository. Make sure you put your GitHub repository url in your package.json file. Also make sure your file includes helpful information about the widget — a summary, features list, and, of course, a screenshot. (example)

Create a Demo App

In your GitHub repository, create a new folder called demo, do an export from your Web AppBuilder test app, and extract the HTML/CSS/JavaScript files into that folder. Add an additional task to your Gruntfile called “deploy” and have it publish your demo folder to this repository’s gh-pages branch (example). Now you have a demo of your widget if you go to (example)

For bonus, take the url of our demo app and make it the “primary url” of your GitHub repository so it’s easy for people to see your demo:


Share and Publicize

  • ArcGIS Code Sharing – Zip up your widget files and post to ArcGIS Code Sharing. In the description, link to your demo app as well as your GitHub repository (in case you update your widget on GitHub but forget to update Code Sharing in the future). (example)
  • GeoNet – Post an announcement about your new widget to the Web AppBuilder Custom Widgets Group. Upload your files if you want, or just link to ArcGIS Code Sharing and/or your GitHub repository.
  • Twitter – Tweet out a link to your new widget. Include a screenshot and the #webappbuilder hashtag.
  • Other Lists – there are a few other compilation lists out there. Most likely ArcGIS Code Sharing will be the place for this in the long-term, but for now it’s probably good to list your widget on these too.

That’s it! Now your widget is destined for fame and fortune. On to the next one!

GitHub CSV Import

github-csv-importHave you ever wanted to import issues from a different system into GitHub? I just released a new tool that will allow you to do that. All you need to do is get your issues into a simple CSV format including title, description, and the tags that you want, and the script will do the rest.


To use, just install using npm install -g github-csv-tools and then run githubCsvTools myFile.csv from the command line, referencing your CSV file that you want to import. It’ll ask you for a GitHub token, and a few other details, and then you’ll have your issues in GitHub!


Right now the tool only does importing, but more will come soon! Please leave comments here, or in the GitHub repository.

Newer Posts
Older Posts

Gavin Rehkemper

JavaScript, WordPress, and GeoDev