Skip to content

Instantly share code, notes, and snippets.

@colindean
Last active July 2, 2021 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colindean/ed3abbec54870e2187920a36100292cd to your computer and use it in GitHub Desktop.
Save colindean/ed3abbec54870e2187920a36100292cd to your computer and use it in GitHub Desktop.
MOVED TO https://github.com/colindean/wilkinsburg_pittsburgh_merger_analysis! -> Heat Map Chart reflecting percent change in municipal and school tax if Wilkinsburg and Pittsburgh merge (WORK IN PROGRESS)
*.png
*.svg
*.idx
wilkinsburg*.csv
assessments.csv

Heat Map Chart reflecting percent change in municipal and school tax if Wilkinsburg and Pittsburgh merge

This is a heat map charting the percentage change difference when accounting for earned income tax and real estate and school tax going from Wilkinsburg to Pittsburgh under the proposed merger. Blue means taxes go down, red means taxes go up. The darker the color, the deeper the change. The white line that is approximately diagonal is The sweet spot of no change.

The graph itself is quite simple math but I've chosen the ranges based on some heuristics:

  • The range for property value is based on June 2021 county assessment data from WPRDC for the whole municipality, but residences only. The mean assessed value is around $41,000 in the standard deviation is about $49,000. Very few are under $20,000 so I chose $20,000 as the starting point and three standard deviations above the mean, approximately $190,000, as the max for that axis.
  • For earned income taxes, I chose $15,000 as approximately full-time minimum wage and $300,000 as two income highly skilled professional household. I don't know where I can get better data on incomes so if you have a suggestion I'm all ears.

Future Work

What I would love to do is somehow scale this or carve out areas on the graph that include various percentages of the Wilkinsburg population.

The biggest assumption of this graph is that somebody looking at it is paying property taxes opaquely. That is, they know precisely how much their property tax is or they are paying it as a part of their mortgage, not something rolled into their rent.

I also want to make some more versions of this graph:

  1. One that does not include a school district merger so folks can see that effect.
  2. One that shows dollar change instead of percentage change, because folks rarely actually remember how much they pay in taxes to be able to multiply it.

Help Wanted

I could use a GNUplot expert to help me clean up the code and help make the color changes more stark.

I could use someone interested in make a small static website for this. I'll probably get around to this eventually myself but it's low on the priority list until I have more insight to present.

ASSESSEMENTS_URL=https://data.wprdc.org/dataset/2b3df818-601e-4f06-b150-643557229491/resource/f2b8d575-e256-4718-94ad-1e12239ddb92/download/assessments.csv
MUNI_CODE ?= 866
CLASS_RESIDENCE = RESIDENTIAL
FILES = $(wildcard *.gnuplot)
TARGETS = $(FILES:gnuplot=svg) $(FILES:gnuplot=png)
ASSESSMENTS = assessments.csv
XSV ?= xsv
INKSCAPE ?= flatpak run org.inkscape.Inkscape
all: $(TARGETS)
%.svg: %.gnuplot
gnuplot $< > $@
%.png: %.svg
$(INKSCAPE) --export-filename=$@ --export-overwrite --export-type=png $<
debug:
@echo "FILES: $(FILES)"
@echo "TARGETS: $(TARGETS)"
.PHONY: get-county-data
get-county-data: $(ASSESSMENTS)
$(ASSESSMENTS):
curl --output $@ "$(ASSESSMENTS_URL)"
%.csv.idx: %.csv
$(XSV) index $< --output $@
wilkinsburg.csv: assessments.csv assessments.csv.idx
$(XSV) search --select $(shell xsv headers $(ASSESSMENTS) | grep MUNICODE | cut -f 1 -d ' ') $(MUNI_CODE) $< > $@
wilkinsburg-residence.csv: wilkinsburg.csv wilkinsburg.csv.idx
$(XSV) search --select $(shell xsv headers $(ASSESSMENTS) | grep CLASSDESC | cut -f 1 -d ' ') $(CLASS_RESIDENCE) $< > $@
mean-stddev: wilkinsburg-residence.csv
$(XSV) stats $< | $(XSV) search --select 1 COUNTYTOTAL | xsv select mean,stddev
# edit at https://thetimetube.herokuapp.com/gnuplotviewer/
set terminal svg enhanced size 1920,1080
# https://alleghenycountytreasurer.us/real-estate-tax/
# 4.73 mills
allegheny_county_property_taxes(x) = x * (4.73/1000)
#
wilkinsburg_income_taxes(x) = x * 0.01
pittsburgh_income_taxes(x) = x * 0.03
# https://alleghenycountytreasurer.us/real-estate-tax/local-and-school-district-tax-millage/
wilkinsburg_borough_property_taxes(x) = x * (14.00/1000)
wilkinsburg_school_property_taxes(x) = x * (29.5/1000)
wilkinsburg_total_property_taxes(x) = wilkinsburg_borough_property_taxes(x) + wilkinsburg_school_property_taxes(x)
pittsburgh_borough_property_taxes(x) = x * (8.06/1000)
pittsburgh_school_property_taxes(x) = x * (9.95/1000)
pittsburgh_total_property_taxes(x) = pittsburgh_borough_property_taxes(x) + pittsburgh_school_property_taxes(x)
wilkinsburg_taxes(income,property) = wilkinsburg_income_taxes(income) + wilkinsburg_total_property_taxes(property)
pittsburgh_taxes(income,property) = pittsburgh_income_taxes(income) + pittsburgh_total_property_taxes(property)
pct_change(income,property) = (pittsburgh_taxes(income,property) / wilkinsburg_taxes(income,property)) * 100
set tic scale 0
#set palette rgbformula 30,31,32 #33,13,10
# line styles
set style line 1 lt 1 lc rgb '#5548c1' #
set style line 2 lt 1 lc rgb '#7982d7' #
set style line 3 lt 1 lc rgb '#abb8e7' #
set style line 4 lt 1 lc rgb '#dde3ef' #
set style line 5 lt 1 lc rgb '#ead3c6' #
set style line 6 lt 1 lc rgb '#dba188' #
set style line 7 lt 1 lc rgb '#ca6b55' #
set style line 8 lt 1 lc rgb '#b10027' #
# palette
set palette defined(\
40 '#5548c1',\
100 '#ffffff',\
250 '#b10027')
set cblabel "Percent Change in Total Taxes from Wilkinsburg to Pittsburgh"
set format cb "%.1f%%"
set cbtics 10
#set cbrange [:250]
#unset cbtics
set termoption enhanced
save_encoding = GPVAL_ENCODING
set encoding utf8
set title "Proposed Wilkinsburg/Pittsburgh Merger Effect on Total Income and Property Tax for Wilkinsburg Residents"
#set key Left center top reverse
unset key
set decimal locale
set xlabel "Earned Income Taxes"
set xrange [ 15000 : 300000 ]
set format x "$%'.0f"
set xtics 5000 rotate by 45
set yrange [ 20000 : 190000 ]
set ylabel "County-Assessed Property Value"
set format y "$%'.0f"
set ytics 20000
#set pm3d implicit at s
set pm3d at b
set isosamples 47,38
set style fill solid 1 noborder
set view map
splot pct_change(x,y), \
'++' using (sprintf("%.2f", pct_change(x,y))) with labels
#splot '++' matrix using 1:2:(pct_change($1,$2)) with image, \
# '++' matrix using 1:2:(sprintf("%g", pct_change($1,$2))) with labels
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment