Using matplotlib patches to build up something beautiful

Polar heatmap showing the speed and direction of the wind with the colors representing the average temperatures in that bucket. (Image by author)

I really enjoy using Python + matplotlib not just because of its simplicity, but because you can use it to create very clean and artful images. One thing to let go of is using the predefined plotting methods in the library, but instead taking a look at the geometries and patches that are included in matplotlib.

The image above was created purely with sets of Wedge patches. It is clean and beautiful and now I will show you how to do it. …

A nice little recursive function to read tables into MATLAB

Photo by Tom Podmore on Unsplash

One common thing that I deal with in my work is reading of CSV files into MATLAB. Generally the way it goes is that I have a nested set of directories that contain .csv files which need to be parsed into my code. The main annoyance is that there is not guarantee how deep and how many .csv files will be in the sub-directories. So how do we solve this? RECURSSION!

Example Directory Structure

Imagine we have the following structure that we need to parse:

Step by step guide to adding hand animations to XR

What we will be making

I very recently started to play around in Unity to develop for my Oculus Quest and the first thing I did was install the Oculus Integration package from the asset store. Right away I could do some interesting things and all was well. Then after spending more time with it I realized there were some limitations so I made the switch to the XR package in Unity which is meant to unify AR and VR development platforms.

The major issue is that the XR package does not come with some pretty basic stuff like hand meshes and animations. I Googled…

A super easy and clean way to continuously monitor changes in websites

Photo by Eric Krull on Unsplash

While looking for some fun events to do with the kids during COVID times I noticed that all of the events got sold out faster than I could check them! If only there was a way to alert me via email when the website changed from “Sold Out” to “Available”… Oh wait… I know how to do this.

The Plan

All I am going to do here is setup a python script that will connect to my Gmail account via an App Password (Which I will discuss soon) then parse the website for changes. When the site has the change I want…

Making a Framework for API Development and Deployment

Photo by Markus Spiske on Unsplash

I really enjoy making stuff, but I really hate deployment. I have a bunch of ideas that sit on my local machine and just gather dust since I cannot be bothered to deploy them for the world to see. In the past, I kept trying to set up my own server from scratch. This included installing all of the linux packages, dealing with nginx configs and just all of the server management stuff I really don’t have a taste for. For some reason in my development life, I never heard of Heroku. Heroku is perfect for what I need. It…

Using Python, Geobinning and Matplotlib to Generate Choropleth Maps

I see a lot of choropleth maps out there that looks very nice and really draw a lot of attention. Creating these is super easy if you have a clean dataset, however, a lot of the data I want to explore is not bucketed in the way I would like. More often than not it comes in the form of coordinates (lat/lng) which leaves it up to me to figure out which areas of the map they should go.

ie. I need to figure out how to Geobin the results

To do this I have created a pypi library called…

A sad and painful journey of self-reflection.

Photo by Tadas Sar on Unsplash

NB: If you can use linux please do! I had to use Windows at my company because the IT will not give us linux boxes. Therefore, after a lot of hair pulling I had to figure out how to deploy a flask API.

For this short article, I will not go into detail about the actual creation of the flask API but more about how to deploy. Here is a super-condensed step by step to get a flask API running.


pip install flask waitress

You will notice we are installing waitress which is a Windows compatible server that we can…

An annoying issue that I decided to solve

A discrete set of colour bars on the right (Original Content)

I like to use the python library for Plotly, however I noticed that when I am trying to use the Graph Object to do things like make Choropleth maps I was having trouble getting discrete colour ranges for my data.

I like to segment my data into regions based on category. For example if I am trying to show three categories of data I will use the ranges of 0–33 for the first set set, 34–66 for the second and finally 67–100. Within each of these categories I wanted to display its own set of discrete colours (see the main…

Twitter data extraction and visualization.

‘“The Donald tweets a LOT! SO TRUE! He’s the best at tweeting ask anyone!! The FAKE dems will tell you otherwise. SAD!” — Donald Trump’ -Kyle Pastor

Everyone knows that Trump is a huge Twitter user, but rather than looking at what he tweets I wanted to get a visual understanding of who tweets at him. This little tidbit will go over how to use python to extract the raw tweets directed at Trump and how to use geocoding to determine coordinates based on twitter user data. Finally we will modify and export the data to

Check out the…

Come on in, the water's fine!

New York City Flooding (Kyle Pastor)

In a previous article I wrote we talked about using Mapbox and Python to get super high resolution satellite images. In addition to the satellite images we were also able to get elevation mappings which basically tells us the elevation at every pixel in meters. For more details see the following:

This time I want to take that data and apply it to something interesting.

What would happen if the sea level were to rise? How would a city look under all of that water?

We will assume we ran the code to get the imagery from before, so what…

Kyle Pastor

Analytics | Full Stack | Data Science | MS Physics + MS Quant Finance →

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store