From 2a856581e1423419e123fbd38196710b0c41ce87 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Wed, 7 May 2025 22:49:53 +0530 Subject: [PATCH 01/16] Update 2-bar-plot.ipynb --- src/2-bar-plot.ipynb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/2-bar-plot.ipynb b/src/2-bar-plot.ipynb index 9d3fb712..f1eca1b8 100644 --- a/src/2-bar-plot.ipynb +++ b/src/2-bar-plot.ipynb @@ -15,6 +15,23 @@ "source": [ "# TASK: Create a bar plot with the following data: categories = ['A', 'B', 'C', 'D'] and values = [5, 7, 3, 9].\n", "# Use different colors for each bar and add a title to the plot." + "import matplotlib.pyplot as plt\n", + "\n", + "# Data\n", + "categories = ['A', 'B', 'C', 'D']\n", + "values = [5, 7, 3, 9]\n", + "colors = ['red', 'blue', 'green', 'orange']\n", + "\n", + "# Create bar plot\n", + "plt.bar(categories, values, color=colors)\n", + "\n", + "# Customize plot\n", + "plt.title('Bar Plot with Colors')\n", + "plt.xlabel('Categories')\n", + "plt.ylabel('Values')\n", + "\n", + "# Show plot\n", + "plt.show()" ] } ], From 571cba6cdeea475b076149bf19240336707281c2 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Wed, 7 May 2025 23:12:47 +0530 Subject: [PATCH 02/16] Update 3-scatter-plot.ipynb --- src/3-scatter-plot.ipynb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index 9bed601f..6b895bc1 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -15,6 +15,27 @@ "source": [ "# TASK: Create a scatter plot with x = [1, 2, 3, 4, 5] and y = [2, 4, 6, 8, 10].\n", "# Annotate each point with its (x, y) value, and set the title as 'Scatter Plot with Annotations'." + "import matplotlib.pyplot as plt\n", + "\n", + "# Data\n", + "x = [1, 2, 3, 4, 5]\n", + "y = [2, 4, 6, 8, 10]\n" + "\n", + "# Create scatter plot\n", + "plt.scatter(x, y)\n", + "\n", + "# Annotate each point\n", + "for i in range(len(x)):\n", + "plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n", + "\n", + "# Customize plot\n", + "plt.title('Scatter Plot with Annotations')\n", + "plt.xlabel('X-axis')\n", + "plt.ylabel('Y-axis')\n", + "\n", + "# Show plot\n", + "plt.grid(True)\n", + "plt.show()", ] } ], From 6cecd097bd35cf54684a1587344525739e5f900d Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Wed, 7 May 2025 23:17:56 +0530 Subject: [PATCH 03/16] Update 3-scatter-plot.ipynb --- src/3-scatter-plot.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index 6b895bc1..b2041804 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -26,7 +26,7 @@ "\n", "# Annotate each point\n", "for i in range(len(x)):\n", - "plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n", + "plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n" "\n", "# Customize plot\n", "plt.title('Scatter Plot with Annotations')\n", From ead325c8244df50deb5eccf6c3a373b082a9f325 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:06:13 +0530 Subject: [PATCH 04/16] Update 3-scatter-plot.ipynb --- src/3-scatter-plot.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index b2041804..337e36ab 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -26,7 +26,7 @@ "\n", "# Annotate each point\n", "for i in range(len(x)):\n", - "plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n" + 'plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n' "\n", "# Customize plot\n", "plt.title('Scatter Plot with Annotations')\n", From 75e1cf13d4e83609e8afb4803d4152d98e53a89a Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:08:18 +0530 Subject: [PATCH 05/16] Update 3-scatter-plot.ipynb --- src/3-scatter-plot.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index 337e36ab..12d23072 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -26,7 +26,7 @@ "\n", "# Annotate each point\n", "for i in range(len(x)):\n", - 'plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n' + "plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n" "\n", "# Customize plot\n", "plt.title('Scatter Plot with Annotations')\n", From 643f7d9a1346e05033548e28fda035520e024a3e Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:11:45 +0530 Subject: [PATCH 06/16] Update 3-scatter-plot.ipynb --- src/3-scatter-plot.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index 12d23072..82c68ca1 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -26,7 +26,7 @@ "\n", "# Annotate each point\n", "for i in range(len(x)):\n", - "plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n" + plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center') "\n", "# Customize plot\n", "plt.title('Scatter Plot with Annotations')\n", From 30b38369c05aaa06676e0d7315f2401ea99e6f05 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:19:21 +0530 Subject: [PATCH 07/16] Update 1-line-plot.ipynb --- src/1-line-plot.ipynb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/1-line-plot.ipynb b/src/1-line-plot.ipynb index eab74494..44100a05 100644 --- a/src/1-line-plot.ipynb +++ b/src/1-line-plot.ipynb @@ -15,6 +15,23 @@ "source": [ "# TASK: Create a line plot with x values ranging from 0 to 10 and y values as the square of x.\n", "# Customize the plot by adding a title, labels for both axes, and a grid." + "mport matplotlib.pyplot as plt\n", + "\n", + "# Define x and y values\n" + "x = list(range(11))\n", + "y = [i**2 for i in x]", + "\n", + "# Create the plot\n", + "plt.plot(x, y)\n", + "\n", + "# Customize the plot\n", + "plt.title('Square Numbers Line Plot')", + "plt.xlabel('X values')\n", + "plt.ylabel('Y = X Squared')\n", + "plt.grid(True)\n", + "\n", + "# Show the plot\n", + "plt.show()" ] } ], From 5b46cefadbd49983b256a53961728482967a5cf8 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:21:26 +0530 Subject: [PATCH 08/16] Update 3-scatter-plot.ipynb --- src/3-scatter-plot.ipynb | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index 82c68ca1..9bed601f 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -15,27 +15,6 @@ "source": [ "# TASK: Create a scatter plot with x = [1, 2, 3, 4, 5] and y = [2, 4, 6, 8, 10].\n", "# Annotate each point with its (x, y) value, and set the title as 'Scatter Plot with Annotations'." - "import matplotlib.pyplot as plt\n", - "\n", - "# Data\n", - "x = [1, 2, 3, 4, 5]\n", - "y = [2, 4, 6, 8, 10]\n" - "\n", - "# Create scatter plot\n", - "plt.scatter(x, y)\n", - "\n", - "# Annotate each point\n", - "for i in range(len(x)):\n", - plt.annotate(f"({x[i]}, {y[i]})", (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center') - "\n", - "# Customize plot\n", - "plt.title('Scatter Plot with Annotations')\n", - "plt.xlabel('X-axis')\n", - "plt.ylabel('Y-axis')\n", - "\n", - "# Show plot\n", - "plt.grid(True)\n", - "plt.show()", ] } ], From 5635a93ffb6f9ebba931970fd36bbb2c96edaa91 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:26:31 +0530 Subject: [PATCH 09/16] Update 3-scatter-plot.ipynb --- src/3-scatter-plot.ipynb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index 9bed601f..88a97aac 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -15,6 +15,24 @@ "source": [ "# TASK: Create a scatter plot with x = [1, 2, 3, 4, 5] and y = [2, 4, 6, 8, 10].\n", "# Annotate each point with its (x, y) value, and set the title as 'Scatter Plot with Annotations'." + "import matplotlib.pyplot as plt\n", + "\n", + "# Data\n", + "x = [1, 2, 3, 4, 5]\n", + "y = [2, 4, 6, 8, 10]\n", + "\n", + "# Create scatter plot\n", + "plt.scatter(x, y)\n", + "\n", + "# Annotate each point\n", + "for i in range(len(x)): \n", + "plt.annotate(f'({x[i]}, {y[i]})', (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n", + "\n", + "# Set title\n", + "plt.title('Scatter Plot with Annotations')", + "\n", + "# Show plot\n", + "plt.show()" ] } ], From 69e0c2241f1995d38b79166fe8d2b8fef43854b0 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:27:13 +0530 Subject: [PATCH 10/16] Update 3-scatter-plot.ipynb --- src/3-scatter-plot.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index 88a97aac..c1f22f76 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -26,7 +26,7 @@ "\n", "# Annotate each point\n", "for i in range(len(x)): \n", - "plt.annotate(f'({x[i]}, {y[i]})', (x[i], y[i]), textcoords="offset points", xytext=(5,5), ha='center')\n", + "plt.annotate(f'({x[i]}, {y[i]})', (x[i], y[i]), textcoords= "offset points", xytext=(5,5), ha='center')\n", "\n", "# Set title\n", "plt.title('Scatter Plot with Annotations')", From 5b53871bbe2f3098fda2c31f648d51db6fde1b80 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:27:53 +0530 Subject: [PATCH 11/16] Update 3-scatter-plot.ipynb --- src/3-scatter-plot.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3-scatter-plot.ipynb b/src/3-scatter-plot.ipynb index c1f22f76..f52dcbc5 100644 --- a/src/3-scatter-plot.ipynb +++ b/src/3-scatter-plot.ipynb @@ -26,7 +26,7 @@ "\n", "# Annotate each point\n", "for i in range(len(x)): \n", - "plt.annotate(f'({x[i]}, {y[i]})', (x[i], y[i]), textcoords= "offset points", xytext=(5,5), ha='center')\n", + "plt.annotate(f'({x[i]}, {y[i]})', (x[i], y[i]), textcoords= 'offset points', xytext=(5,5), ha='center')\n", "\n", "# Set title\n", "plt.title('Scatter Plot with Annotations')", From 2c44177dbc5e10b4af6d0325ad762eb27714bbe2 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:30:47 +0530 Subject: [PATCH 12/16] Update 4-pie-chart.ipynb --- src/4-pie-chart.ipynb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/4-pie-chart.ipynb b/src/4-pie-chart.ipynb index eedc5b94..4df89138 100644 --- a/src/4-pie-chart.ipynb +++ b/src/4-pie-chart.ipynb @@ -15,6 +15,21 @@ "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] + +# Create pie chart +plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140) + +# Equal aspect ratio ensures pie is drawn as a circle +plt.axis('equal') +plt.title('Programming Language Usage') + +# Show plot +plt.show() ] } ], From 41fce53258de2e31271749684a43e9765b0e67b4 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:34:23 +0530 Subject: [PATCH 13/16] Update 4-pie-chart.ipynb --- src/4-pie-chart.ipynb | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/4-pie-chart.ipynb b/src/4-pie-chart.ipynb index 4df89138..47e8c476 100644 --- a/src/4-pie-chart.ipynb +++ b/src/4-pie-chart.ipynb @@ -15,21 +15,21 @@ "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] - -# Create pie chart -plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140) - -# Equal aspect ratio ensures pie is drawn as a circle -plt.axis('equal') -plt.title('Programming Language Usage') - -# Show plot -plt.show() + "import matplotlib.pyplot as plt\n", + "\n", + "# Data\n", + "labels = ['Python', 'Java', 'C++', 'JavaScript']\n", + "sizes = [40, 25, 20, 15]\n", + "\n", + "# Create pie char\n", + "plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)\n", + "\n"," + "# Equal aspect ratio ensures pie is drawn as a circle\n", + "plt.axis('equal')\n", + "plt.title('Programming Language Usage')\n", + "\n", + "# Show plot\n", + "plt.show()" ] } ], From 366558a6f0702caf6dcf7ff794e8c31282f4c353 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:34:55 +0530 Subject: [PATCH 14/16] Update 4-pie-chart.ipynb --- src/4-pie-chart.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/4-pie-chart.ipynb b/src/4-pie-chart.ipynb index 47e8c476..17876410 100644 --- a/src/4-pie-chart.ipynb +++ b/src/4-pie-chart.ipynb @@ -23,7 +23,7 @@ "\n", "# Create pie char\n", "plt.pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)\n", - "\n"," + "\n", "# Equal aspect ratio ensures pie is drawn as a circle\n", "plt.axis('equal')\n", "plt.title('Programming Language Usage')\n", From d00da8808800efd85a30156e4d79189b14ea92f8 Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:42:15 +0530 Subject: [PATCH 15/16] Update 5-subplot.ipynb --- src/5-subplot.ipynb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/5-subplot.ipynb b/src/5-subplot.ipynb index 98e4fa95..0fceb0a7 100644 --- a/src/5-subplot.ipynb +++ b/src/5-subplot.ipynb @@ -15,6 +15,39 @@ "source": [ "# TASK: Create a 2x2 subplot layout.\n", "# Plot a line chart in the first subplot, a bar chart in the second, a scatter plot in the third, and a pie chart in the fourth." + "import matplotlib.pyplot as plt\n", + "\n", + "# Sample data\n", + "x = [1, 2, 3, 4, 5]\n", + "y = [10, 20, 25, 30, 40]\n", + "categories = ['A', 'B', 'C', 'D']\n", + "values = [5, 7, 3, 4]\n", + "labels = ['Python', 'Java', 'C++', 'JavaScript']\n", + "sizes = [40, 25, 20, 15]\n", + "\n", + "# Create 2x2 subplot layout\n", + "fig, axs = plt.subplots(2, 2, figsize=(10, 8))\n", + "\n", + "# Line chart\n", + "axs[0, 0].plot(x, y)\n", + "axs[0, 0].set_title('Line Chart')\n", + "\n", + "# Bar chart\n", + "axs[0, 1].bar(categories, values)\n", + "axs[0, 1].set_title('Bar Chart')\n", + "\n", + "# Scatter plot\n", + "axs[1, 0].scatter(x, y)\n", + "axs[1, 0].set_title('Scatter Plot')\n", + "\n", + "# Pie chart\n", + "axs[1, 1].pie(sizes, labels=labels, autopct='%1.1f%%', startangle=140)\n", + "axs[1, 1].set_title('Pie Chart')\n", + "axs[1, 1].axis('equal')\n", + "\n", + "# Adjust layout\n", + "plt.tight_layout()\n", + "plt.show()" ] } ], From dc7bac423f7b400fef3e6197091a70bcf08ab20d Mon Sep 17 00:00:00 2001 From: Harini20-hub Date: Thu, 8 May 2025 00:48:42 +0530 Subject: [PATCH 16/16] Update 6-histogram.ipynb --- src/6-histogram.ipynb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/6-histogram.ipynb b/src/6-histogram.ipynb index 5e6e6b60..e0beadfe 100644 --- a/src/6-histogram.ipynb +++ b/src/6-histogram.ipynb @@ -15,6 +15,21 @@ "source": [ "# TASK: Create a histogram for the following data: data = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5].\n", "# Customize the histogram with a title, labels for the x-axis, and a specific color for the bars." + "import matplotlib.pyplot as plt\n", + "\n", + "# Data\n", + "data = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5]\n", + "\n", + "# Create histogram\n", + "plt.hist(data, bins=5, color='skyblue', edgecolor='black')\n", + "\n", + "# Customization\n", + "plt.title('Histogram of Given Data')\n", + "plt.xlabel('Value')\n", + "plt.ylabel('Frequency')\n", + "\n", + "# Show plot\n", + "plt.show()", ] } ],