Python - Create Scatter Chart Using Matplotlib

by matt392 in Circuits > Software

28 Views, 1 Favorites, 0 Comments

Python - Create Scatter Chart Using Matplotlib

Matplotlib-ScatterGraph.png
matplotlib.png
import matplotlib.pyplot as mattexample

print ("Imported matplotlib as 'mattexample'")

# x axis values
x = [2, 4, 6, 8, 10, 12, 14, 16]

# y axis
y = [7, 5, 8, 6, 7, 8, 10, 14]

print("The x-axis values are: ", x)
print("The y-axis values are: ", y)

# Invoke scatter function to generate scatter graph
print ("Now invoking the scatter function.")
mattexample.scatter(x,y)

# Invoke the show function to display the scatter graph
print ("Now to display the scatter graph.")
mattexample.show()