THE WORLD'S LARGEST WEB DEVELOPER SITE

Artificial Intelligence

Scatter Plots

  • Data Collections
  • Scatter Plots
  • Graphs

Data Collection

Collecting data is the most important part of any Machine Intelligence projects.

The most common data to collect are numbers and measurements.

Often data are stored in arrays representing the relationship between values.

This table contains house prices versus size:

Price788999 910111415
Size5060708090100 110120130140150

Scatter Plots

A Scatter Plot has points scattered over an area representing the relationship between two values.

Prices

Example

# Name the Axis
plt.title('House Prices vs Size')
plt.xlabel('Square Meters')
plt.ylabel('Price in Millions')

# Set x and y values
x = np.array([50,60,70,80,90,100,110,120,130,140,150,160])
y = np.array([7,8,8,9,9,9,9,10,11,14,14,15])

# Scatter Plot Data
plt.scatter(x, y)
plt.show()
Try it Yourself »

Graphs

A Graph can also be used to show the same values:

Price788999 910111415
Size5060708090100 110120130140150
Graph

Example

# Name the Axis
plt.title('House Prices vs Size')
plt.xlabel('Square Meters')
plt.ylabel('Price in Millions')

# Set x and y values
x = np.array([50,60,70,80,90,100,110,120,130,140,150,160])
y = np.array([7,8,8,9,9,9,9,10,11,14,14,15])

# Plot a Graph
plt.plot(x, y)
plt.show()
Try it Yourself »