Surya_from_1627

ADAP5

Sep 10th, 2026
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.87 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2.  
  3. x = [1, 2, 3, 4, 5]
  4. y = [10, 12, 8, 14, 11]
  5.  
  6. plt.plot(x, y, marker='o', linestyle='--', color='green')
  7. plt.title('Line Plot Example')
  8. plt.xlabel('X-axis')
  9. plt.ylabel('Y-axis')
  10. plt.grid(True)
  11. plt.show()
  12. -----------------------------------------------------------
  13. import seaborn as sns
  14. import pandas as pd
  15.  
  16. data = pd.DataFrame({
  17.     'Item': ['Apple', 'Banana', 'Carrot'],
  18.     'Quantity': [10, 5, 8]
  19. })
  20.  
  21. sns.barplot(x='Item', y='Quantity', data=data, hue='Item', legend=False)
  22. plt.title("Bar Chart with Color Palette")
  23. plt.show()
  24. ------------------------------------------------------------
  25. sns.boxplot(data=[10, 20, 25, 30, 80])
  26. plt.title("Box Plot Showing Outlier")
  27. plt.show()
  28. -----------------------------------------------------------
  29. df = sns.load_dataset("iris")
  30. correlation = df.corr(numeric_only=True)
  31.  
  32. sns.heatmap(correlation, annot=True, cmap='coolwarm')
  33. plt.title("Heatmap of Iris Dataset Correlation")
  34. plt.show()
  35. ---------------------------------------------------------------
  36. sns.pairplot(df, hue='species')
  37. plt.suptitle("Pairplot with Hue = Species", y=1.02)
  38. plt.show()
  39. ------------------------------------------------------
  40. sns.histplot(df['sepal_length'], kde=True, color='orange')
  41. plt.title("Distribution Plot of Sepal Length")
  42. plt.show()
  43. ---------------------------------------------------------
  44. plt.plot([1, 2, 3], [4, 5, 6])
  45. plt.annotate('Peak Point', xy=(2, 5), xytext=(2.5, 5.5),
  46.              arrowprops=dict(facecolor='black', shrink=0.05))
  47. plt.title("Plot with Annotation")
  48. plt.show()
  49. ---------------------------------------------------------
  50. sizes = [40, 35, 25]
  51. labels = ['Apple', 'Banana', 'Carrot']
  52. colors = ['#ff9999','#66b3ff','#99ff99']
  53.  
  54. plt.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%', startangle=140)
  55. plt.title("Pie Chart of Fruit Distribution")
  56. plt.axis('equal')
  57. plt.show()
  58.  
Advertisement
Add Comment
Please, Sign In to add comment