Loading…
DS · Visualisation · Program 10 · In the record
Bar chart, histogram, pie chart, box plot, scatter plot and heatmap.
1import pandas as pd2import matplotlib.pyplot as plt3import seaborn as sns4 5df = pd.DataFrame({'Name': ['Alice', 'Bob', 'Charlie', 'David', 'Eve'],6 'Age': [25, 30, 35, 40, 45],7 'Salary': [50000, 60000, 70000, 80000, 90000]})8 9fig, ax = plt.subplots(2, 3, figsize=(15, 9))10ax[0, 0].bar(df['Name'], df['Salary'])11ax[0, 0].set_title("Bar Chart")12ax[0, 1].hist(df['Age'], bins=5)13ax[0, 1].set_title("Histogram")14ax[0, 2].pie(df['Salary'], labels=df['Name'], autopct='%1.1f%%')15ax[0, 2].set_title("Pie Chart")16ax[1, 0].boxplot(df['Salary'])17ax[1, 0].set_title("Box Plot")18ax[1, 1].scatter(df['Age'], df['Salary'])19ax[1, 1].set_title("Scatter Plot")20sns.heatmap(df[['Age', 'Salary']].corr(), annot=True, ax=ax[1, 2]).set_title("Heatmap")21plt.tight_layout()22plt.show()(graph only - no printed output)

Run program 10 in your browser
Python 3.14 · Pyodide. Change the code or the input, run it, break it, and see what happens.