DEV Community

Cover image for Visualizing the Primary Debates
Charles Landau
Charles Landau

Posted on • Edited on

9 3

Visualizing the Primary Debates

The past couple days in the US, the Democrats have been debating about who should get to run against Trump. The transcripts seemed like a fun subject for dataviz.

All the code for these visualizations are posted here in various commits.

Firstly I thought it would be helpful to get a simple bar showing how much the candidates spoke.

Note: as you'll see, I didn't take time to ensure a perfect cleanse of the data. There are some artifacts and errors, which will be obvious in the word clouds.

dems_word_count

I was also surprised to find that if you create a TF-IDF based distance matrix...

dems_distance_matrix_viz

... The speakers sort themselves out nicely. The lowest-polling person I've seen described as T1 is Mayor Pete, and the pattern holds whether or not you count him as T1.

Does this mean anything? I don't think so, at least not all on its own.

Finally here are some word clouds:

dems_word_clouds

Overall I think this was a fun little exercise, but I don't suspect that it says too much about the race.

Let me know what you think! Especially if you notice a mistake.

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (6)

Collapse
 
thaothanhluu profile image
Thao Thanh Luu

The word clouds are really difficult to read due to the colors but regardless this is great!

Collapse
 
charlesdlandau profile image
Charles Landau

Thanks for the feedback! I also did a light-themed version but in my quick testing I felt that it looked worse. You can check it out below:

light_themed_wc

Let me know if you think that's better

Collapse
 
recss profile image
Kevin K. Johnson

Probably easier to read, but both versions have contrast issues. The purples on the dark background, the yellows on the light background.

Additionally, word clouds are a bit difficult to read generally.

Thread Thread
 
charlesdlandau profile image
Charles Landau

Yea I agree with that. The Python wordclouds package does the best it can.

Collapse
 
david_j_eddy profile image
David J Eddy

Any chance we could get links to large format images? They look interesting but are small (when I click on them). I esp. like the word cloud concept.

Collapse
 
charlesdlandau profile image
Charles Landau

Thanks! The source images are in the kaggle link I shared at the top.

kaggle.com/charleslandau/democrati...

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay