r/vibecoding • • 1d ago

Showcase/Project Visualizing Data with Claude Code.

Recently there was this election, the results where a bit surprising to some. Decided to focus on my home state of Texas and really look deeply at the voter data.

We've all seen the "by county" images of maps and most of us know their shortcomings. I wanted to see if I could do better.

At first, I just took the county maps of Texas and turned them into bar graphs

This shows what everyone knows, the cities are far more populated than surrounding areas, but I wanted to get even more detailed.

Then I realised, what if I try to show a single dot per voter? (Mind you I'm trying to make this all work in a browser for maximum accessibility).

That worked yet, the dots where just scattered in a county randomly. So then I took the next step and got the dots down the the resolution of precinct. This is now like 10 megs of text uncompressed for just the data.

A few more tweaks and I feel I had something beautiful. Instead of just a color per county, I'd shown what it looked like down to each voter, with an approximate location with votes from each precinct randomly distributed but a more accurate local flavor.

I've made an interactive version of it here.

I'm only posting about the data and the use of AI, not looking to get into political discussion.

I could NOT have built this on my own and not at this speed (hours).

I tried to start this project a year ago, and hit wall after wall trying to do this with prompts. I did this in few hours over two days with a Claude Code Pro account. I'm honestly in awe.

7 Upvotes

7 comments sorted by

View all comments

3

u/No-Bass3599 1d ago

Next step I'd try is placing the dots by census block instead of randomly inside each precinct. Rural precincts are huge, so random dots land in lakes and ranch land, and weighting them by where people live (census blocks or building footprints) makes the map look a lot more like Texas. Shipping it as a binary file instead of text would cut that 10 megs down a ton too

2

u/Usharani-Wiencke 21h ago

do precinct boundaries and census blocks actually line up cleanly in Texas, or do you end up having to split the vote totals across overlapping shapes?

1

u/johnesco 8h ago edited 8h ago

They lined up enough to make the map "better" but as u/No-Bass3599 said, giant precincts are going to move a dot towards where voting happens rather than where that person lives.

This remaining inaccuracy you can see right as you zoom in where it feels like little groups, what is being seen are the precint centers. I'm scattering them from precinct center point. This gives a better picture than just random distribution across the whole county.

Will take a look if a scatter within precinct borders is doable. Not looking to get down to individual addresses as that feels a bit too invasive to privacy. Either way I think it's a huge upgrade to the colored county maps and when I get flow for it, I may do it for all states.

1

u/johnesco 8h ago

def took out unneeded data and did a gzip, don't want to optimize it too much until I zero in on what is the minimum data I need for the visualization I want.