Creating Visual HR Dashboards
Dashboards are powerful tools that bring together multiple data visualizations into a single, easy-to-read interface. In HR, dashboards help you monitor workforce trends, track key metrics, and quickly communicate insights to stakeholders. A well-designed HR dashboard might include charts on employee turnover, department sizes, diversity, or satisfaction scores. The key elements of an effective HR dashboard are clarity, relevance, and the ability to compare related information at a glance.
12345678910111213141516171819202122232425262728import matplotlib.pyplot as plt # Sample HR data departments = ['HR', 'Engineering', 'Sales', 'Marketing'] employee_counts = [12, 45, 30, 18] turnover_rates = [0.08, 0.15, 0.10, 0.12] gender_labels = ['Male', 'Female'] gender_distribution = [60, 45] # Create a dashboard with multiple charts fig, axs = plt.subplots(1, 3, figsize=(15, 5)) # Bar chart: Employee count per department axs[0].bar(departments, employee_counts, color='skyblue') axs[0].set_title('Employees per Department') axs[0].set_ylabel('Number of Employees') # Bar chart: Turnover rate per department axs[1].bar(departments, turnover_rates, color='salmon') axs[1].set_title('Turnover Rate by Department') axs[1].set_ylabel('Turnover Rate') # Pie chart: Gender distribution axs[2].pie(gender_distribution, labels=gender_labels, autopct='%1.1f%%', colors=['lightgreen', 'lightcoral']) axs[2].set_title('Gender Distribution') plt.tight_layout() plt.show()
To display several charts in a single dashboard, you use subplotting. Subplotting lets you arrange multiple charts in one figure, making it easy to compare different HR metrics side by side. The subplots function in matplotlib creates a grid of axes, so you can place each chart in its own panel and control their layout. This approach is especially useful for HR analytics, where you might want to show turnover, department sizes, and diversity metrics together for a comprehensive overview.
12345678910111213141516import matplotlib.pyplot as plt departments = ['HR', 'Engineering', 'Sales', 'Marketing'] employee_counts = [12, 45, 30, 18] fig, ax = plt.subplots(figsize=(6, 4)) bars = ax.bar(departments, employee_counts, color='skyblue') # Customizing the chart for clarity ax.set_title('Number of Employees in Each Department') ax.set_xlabel('Department') ax.set_ylabel('Employees') ax.bar_label(bars, padding=3) plt.tight_layout() plt.show()
1. What is a dashboard in the context of HR analytics?
2. How can multiple charts be displayed together in matplotlib?
3. Fill in the blank: To create subplots in matplotlib, use the _______ function.
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 4.76
Creating Visual HR Dashboards
Swipe to show menu
Dashboards are powerful tools that bring together multiple data visualizations into a single, easy-to-read interface. In HR, dashboards help you monitor workforce trends, track key metrics, and quickly communicate insights to stakeholders. A well-designed HR dashboard might include charts on employee turnover, department sizes, diversity, or satisfaction scores. The key elements of an effective HR dashboard are clarity, relevance, and the ability to compare related information at a glance.
12345678910111213141516171819202122232425262728import matplotlib.pyplot as plt # Sample HR data departments = ['HR', 'Engineering', 'Sales', 'Marketing'] employee_counts = [12, 45, 30, 18] turnover_rates = [0.08, 0.15, 0.10, 0.12] gender_labels = ['Male', 'Female'] gender_distribution = [60, 45] # Create a dashboard with multiple charts fig, axs = plt.subplots(1, 3, figsize=(15, 5)) # Bar chart: Employee count per department axs[0].bar(departments, employee_counts, color='skyblue') axs[0].set_title('Employees per Department') axs[0].set_ylabel('Number of Employees') # Bar chart: Turnover rate per department axs[1].bar(departments, turnover_rates, color='salmon') axs[1].set_title('Turnover Rate by Department') axs[1].set_ylabel('Turnover Rate') # Pie chart: Gender distribution axs[2].pie(gender_distribution, labels=gender_labels, autopct='%1.1f%%', colors=['lightgreen', 'lightcoral']) axs[2].set_title('Gender Distribution') plt.tight_layout() plt.show()
To display several charts in a single dashboard, you use subplotting. Subplotting lets you arrange multiple charts in one figure, making it easy to compare different HR metrics side by side. The subplots function in matplotlib creates a grid of axes, so you can place each chart in its own panel and control their layout. This approach is especially useful for HR analytics, where you might want to show turnover, department sizes, and diversity metrics together for a comprehensive overview.
12345678910111213141516import matplotlib.pyplot as plt departments = ['HR', 'Engineering', 'Sales', 'Marketing'] employee_counts = [12, 45, 30, 18] fig, ax = plt.subplots(figsize=(6, 4)) bars = ax.bar(departments, employee_counts, color='skyblue') # Customizing the chart for clarity ax.set_title('Number of Employees in Each Department') ax.set_xlabel('Department') ax.set_ylabel('Employees') ax.bar_label(bars, padding=3) plt.tight_layout() plt.show()
1. What is a dashboard in the context of HR analytics?
2. How can multiple charts be displayed together in matplotlib?
3. Fill in the blank: To create subplots in matplotlib, use the _______ function.
Thanks for your feedback!