Machine Learning News Hubb
Advertisement Banner
  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us
  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us
Machine Learning News Hubb
No Result
View All Result
Home Artificial Intelligence

Build a Better Bar Chart with This Trick | by Lee Vaughan | Aug, 2023

admin by admin
August 27, 2023
in Artificial Intelligence


(It’s really a seaborn scatter plot!)

Towards Data Science

Part of an “Age of Congress” scatter plot (all images by the author)

Whenever I need inspiration for effective visualizations, I browse The Economist, the Visual Capitalist, or The Washington Post. During one of these forays, I ran across an interesting infographic — similar to the one shown above — that plotted the age of each member of the US Congress against their generational cohort.

My first impression was that this was a horizontal bar chart, but closer inspection revealed that each bar was composed of multiple markers, making it a scatter plot. Each marker represented one member of Congress.

In this Quick Success Data Science project, we’ll recreate this attractive chart using Python, pandas, and seaborn. Along the way, we’ll unlock a cornucopia of marker types you may not know exist.

Because the United States has Age of Candidacy laws, the birthdays of members of Congress are part of the public record. You can find them in multiple places, including the Biographical Directory of the United States Congress and Wikipedia.

For convenience, I’ve already compiled a CSV file of the names of the current members of Congress, along with their birthdays, branch of government, and party, and stored it in this Gist.

The following code was written in Jupyter Lab and is described by cell.

Importing Libraries

from collections import defaultdict  # For counting members by age.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import patches # For drawing boxes on the plot.
import pandas as pd
import seaborn as sns

Assigning Constants for the Generational Data

We’ll annotate the plot so that generational cohorts, such as Baby Boomers and Gen X, are highlighted. The following code calculates the current age spans for each cohort and includes lists for generation names and highlight colors. Because we want to treat these lists as constants, we’ll capitalize the names and use an underscore as a prefix.

# Prepare generational data for plotting as boxes on chart:
CURRENT_YEAR = 2023…



Source link

Previous Post

**Title: Elevate Your Presentations with the 174,125 PowerPoint Template Design** | by Aemtagyto | Aug, 2023

Next Post

Renesas Demonstration of Its Next-generation Artificial Intelligence Accelerator

Next Post

Renesas Demonstration of Its Next-generation Artificial Intelligence Accelerator

Build production-ready generative AI applications for enterprise search using Haystack pipelines and Amazon SageMaker JumpStart with LLMs

Generative AI Weekly — Issue #7 | Ruben Aster

Related Post

Artificial Intelligence

Genius Cliques: Mapping out the Nobel Network | by Milan Janosov | Sep, 2023

by admin
October 1, 2023
Machine Learning

Detecting Anomalies with Z-Scores: A Practical Approach | by Akash Srivastava | Oct, 2023

by admin
October 1, 2023
Machine Learning

What are SWIFT Payments and How Does It Work?

by admin
October 1, 2023
Artificial Intelligence

Speed up your time series forecasting by up to 50 percent with Amazon SageMaker Canvas UI and AutoML APIs

by admin
October 1, 2023
Edge AI

Unleashing LiDAR’s Potential: A Conversation with Innovusion

by admin
October 1, 2023
Artificial Intelligence

16, 8, and 4-bit Floating Point Formats — How Does it Work? | by Dmitrii Eliuseev | Sep, 2023

by admin
September 30, 2023

© Machine Learning News Hubb All rights reserved.

Use of these names, logos, and brands does not imply endorsement unless specified. By using this site, you agree to the Privacy Policy and Terms & Conditions.

Navigate Site

  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us

Newsletter Sign Up.

No Result
View All Result
  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.