Scatter Plot

What is a scatter plot?

Scatter plot is great way to view unorder points.

Creating a scatter plot by using the command:

plt.scatter(x_values, y_values)
# Create Scatter plot 
plt.scatter(df.age, df.height)

# Add labels
plt.xlabel('Age')
plt.ylabel('Height')

# Display data
plt.show()

Keyword arguments

Keywords using in Line Plot will also work with Scatter plot.

  • color
  • maker
plt.scatter(df.age, df.height, color='green', marker='s')
  • Transparent Changing marker transparent by keyword alpha. The smaller the alpha, the more transparent the dots.
plt.scatter(df.x_data, df.y_data, alpha=0.1)