0% found this document useful (0 votes)
5 views7 pages

Matplotlib 1

The document provides examples of using Matplotlib for data visualization in Python. It includes code snippets for line plots, scatter plots, and bar graphs, demonstrating how to customize colors and add legends. The document is structured in a step-by-step format to illustrate different plotting techniques.

Uploaded by

sameera
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)
5 views7 pages

Matplotlib 1

The document provides examples of using Matplotlib for data visualization in Python. It includes code snippets for line plots, scatter plots, and bar graphs, demonstrating how to customize colors and add legends. The document is structured in a step-by-step format to illustrate different plotting techniques.

Uploaded by

sameera
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

MATPLOTLIB

1/7
● %matplotlib inline
import [Link] as plt
[Link]([-1, -4.5, 16, 23])
[Link]()

2/7
● import [Link] as plt
[Link]([-1, -4.5, 16, 23], "ob")
[Link]()

3/7
4/7
● import [Link] as plt

days = list(range(1,9))

celsius_min = [19.6, 24.1, 26.7, 28.3, 27.5, 30.5, 32.8, 33.1]

celsius_max = [24.8, 28.9, 31.3, 33.0, 34.9, 35.6, 38.4, 39.2]

[Link]('Day')

[Link]('Degrees Celsius')

[Link](days, celsius_min,

days, celsius_min, "oy",

days, celsius_max,

days, celsius_max, "or")

[Link]()

5/7
Legend

# next line only needed if working with "ipython


notebook":
%matplotlib inline
import numpy as np
import [Link] as plt
ax = [Link]()
[Link]([1, 2, 3, 4])
[Link](['A simple line'])

6/7
Bar Graph

● bars = [Link]([1,2,3,4], [1,4,9,16])


bars[0].set_color('green')
[Link]()

7/7

You might also like