diff --git a/src/2-bar-plot.ipynb b/src/2-bar-plot.ipynb index 9d3fb712..fc399fe8 100644 --- a/src/2-bar-plot.ipynb +++ b/src/2-bar-plot.ipynb @@ -15,6 +15,20 @@ "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 + +# Data +categories = ['A', 'B', 'C', 'D'] +values = [5, 7, 3, 9] +colors = ['red', 'blue', 'green', 'orange'] # Different colors for each bar + +# Plotting +plt.bar(categories, values, color=colors) +plt.title("Bar Plot of Categories") +plt.xlabel("Categories") +plt.ylabel("Values") +plt.show() + ] } ],