Creating a scatter plot with Matplotlib

Einblick Content Team - February 15th, 2023

Are you struggling to create a scatter plot with Matplotlib? Look no further! In this article, we'll show you how to easily create a scatter plot using matplotlib, the popular data visualization library in Python.

import matplotlib.pyplot as plt
import numpy as np

# Generate random X and Y values
x = np.random.randn(1000)
y = np.random.randn(1000)

# Create customized scatter plot
plt.scatter(x = x, y = y, c = 'r', marker = 'x')
plt.title('Scatter Plot')

Code explanation

  1. Import the necessary libraries, including matplotlib, using the alias plt.
  2. Create your data to be plotted. In this case we’re using NumPy to generate random numbers. You could also import a CSV file, or load data from a database, data warehouse, or data lake.
  3. Use the plt.scatter() function from Matplotlib to create a scatter plot of your data.
  4. Customize the appearance of your scatter plot using various parameters, such as c for color and marker in the plt.scatter() function.
  5. Add labels to the x and y-axis and a title to the graph.
  6. Show your plot using the function from Matplotlib.


Einblick is an AI-native data science platform that provides data teams with an agile workflow to swiftly explore data, build predictive models, and deploy data apps. Founded in 2020, Einblick was developed based on six years of research at MIT and Brown University. Einblick is funded by Amplify Partners, Flybridge, Samsung Next, Dell Technologies Capital, and Intel Capital. For more information, please visit and follow us on LinkedIn and Twitter.

Start using Einblick

Pull all your data sources together, and build actionable insights on a single unified platform.

  • All connectors
  • Unlimited teammates
  • All operators