0% found this document useful (0 votes)
2 views5 pages

Python Notes Set 7

The document provides an overview of basic plotting techniques using Matplotlib and Seaborn, including line, bar, scatter, and histogram plots. It covers customization options, styling, and saving/exporting figures in various formats. Key examples include creating a scatter plot with Seaborn's tips dataset and generating a correlation heatmap.

Uploaded by

fake786king
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Python Notes Set 7

The document provides an overview of basic plotting techniques using Matplotlib and Seaborn, including line, bar, scatter, and histogram plots. It covers customization options, styling, and saving/exporting figures in various formats. Key examples include creating a scatter plot with Seaborn's tips dataset and generating a correlation heatmap.

Uploaded by

fake786king
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Page 1: Matplotlib Basics

import matplotlib.pyplot as plt

Line Plot:

plt.plot([1, 2, 3], [4, 5, 6])

plt.title("Line Plot")

plt.xlabel("X")

plt.ylabel("Y")

plt.show()
Page 2: Bar, Scatter, Histogram

Bar Plot:

plt.bar(['A', 'B'], [10, 20])

Scatter Plot:

plt.scatter([1, 2], [3, 4])

Histogram:

plt.hist([1, 2, 1, 3, 4])

Customize with color, labels, grid


Page 3: Seaborn Overview

import seaborn as sns

Tips dataset:

tips = sns.load_dataset("tips")

sns.scatterplot(x="total_bill", y="tip", data=tips)

Correlation Heatmap:

sns.heatmap(tips.corr(), annot=True)
Page 4: Plot Styling

Line styles:

plt.plot(x, y, linestyle='--', color='r')

Legends:

plt.legend(["Label1", "Label2"])

Subplots:

plt.subplot(1, 2, 1)

plt.plot(x, y)
Page 5: Saving and Exporting Figures

Save figure:

plt.savefig("plot.png")

DPI and format:

plt.savefig("plot.pdf", dpi=300)

Can export to PNG, PDF, SVG etc.

You might also like