DEV Community

loading...
Cover image for Visualizing the Primary Debates

Visualizing the Primary Debates

charlesdlandau profile image Charles Landau Updated on ・1 min read

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.

Discussion (6)

pic
Editor guide
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 Author

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 Author

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 Author

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

kaggle.com/charleslandau/democrati...