From 55faa12dfca232662f4117e81bfe7a4008942f41 Mon Sep 17 00:00:00 2001 From: Divya-15-09 Date: Tue, 20 May 2025 00:00:38 +0530 Subject: [PATCH] Update 4-pie-chart.ipynb --- src/4-pie-chart.ipynb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/4-pie-chart.ipynb b/src/4-pie-chart.ipynb index eedc5b94..df103e29 100644 --- a/src/4-pie-chart.ipynb +++ b/src/4-pie-chart.ipynb @@ -15,6 +15,18 @@ "source": [ "# TASK: Create a pie chart with the following data: labels = ['Python', 'Java', 'C++', 'JavaScript'] and sizes = [40, 25, 20, 15].\n", "# Display the percentages on the chart using autopct." +import matplotlib.pyplot as plt + +# Data +labels = ['Python', 'Java', 'C++', 'JavaScript'] +sizes = [40, 25, 20, 15] + +# Plotting +plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=90) +plt.title("Programming Language Popularity") +plt.axis('equal') # Equal aspect ratio ensures the pie chart is circular. +plt.show() + ] } ],