How to plot multiple values graph in matplotlib?

This recipe helps you plot multiple values graph in matplotlib

Recipe Objective

How to plot multiple values graph in matplotlib.

Learn About the Application of ARCH and GARCH models in Real-World

Step 1- Importing Libraries.

import matplotlib.pyplot as plt import numpy as np

Step 2- Creating multiple arrays

x=np.array([2,5,7,9,10,11,15,18,21,24,27,33,38,40,55,64]) y=np.array([5,1,9,5,10,13,19,15,21,24,28,35,41,45,50,71]) a=np.array([14,17,19,18,28,30,32,38,39]) b=np.array([11,19,22,25,31,34,40,47,48])

Step 3- Plotting the multiple values on same graph.

plt.scatter(x, y, label = "set-1", color='r') plt.scatter(a, b, label = "set-2", color='g') plt.xlabel('xaxis') plt.ylabel('yaxis') plt.legend()

What Users are saying..

profile image

Savvy Sahai

Data Science Intern, Capgemini
linkedin profile url

As a student looking to break into the field of data engineering and data science, one can get really confused as to which path to take. Very few ways to do it are Google, YouTube, etc. I was one of... Read More

Relevant Projects

Build a Medical AI Assistant using Unsloth and QLoRA
In this AI Project, you will learn to fine-tune the LLaMA 3.1 8B model using Unsloth and QLoRA to build a domain-specific medical AI assistant capable of accurate, context-aware, and memory-efficient clinical conversations. It also integrates a Streamlit chatbot interface for real-time interaction and deployment.

Natural language processing Chatbot application using NLTK for text classification
In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

AWS Project to Build and Deploy LSTM Model with Sagemaker
In this AWS Sagemaker Project, you will learn to build a LSTM model on Sagemaker for sales forecasting while analyzing the impact of weather conditions on Sales.

Deep Learning Project for Time Series Forecasting in Python
Deep Learning for Time Series Forecasting in Python -A Hands-On Approach to Build Deep Learning Models (MLP, CNN, LSTM, and a Hybrid Model CNN-LSTM) on Time Series Data.

End-to-End ML Model Monitoring using Airflow and Docker
In this MLOps Project, you will learn to build an end to end pipeline to monitor any changes in the predictive power of model or degradation of data.

Build an Intelligent AI Assistant with FastMCP and LangGraph
In this MCP project, you will learn to build a unified AI assistant that seamlessly integrates diverse development tools and services through the Model Context Protocol. This project demonstrates creating dynamic AI agents using FastMCP servers, LangGraph’s reasoning capabilities, and OpenAI models for intelligent, real-time interaction.

Build a Logistic Regression Model in Python from Scratch
Regression project to implement logistic regression in python from scratch on streaming app data.

NLP and Deep Learning For Fake News Classification in Python
In this project you will use Python to implement various machine learning methods( RNN, LSTM, GRU) for fake news classification.

MLOps Project for a Mask R-CNN on GCP using uWSGI Flask
MLOps on GCP - Solved end-to-end MLOps Project to deploy a Mask RCNN Model for Image Segmentation as a Web Application using uWSGI Flask, Docker, and TensorFlow.

Linear Regression Model Project in Python for Beginners Part 2
Machine Learning Linear Regression Project for Beginners in Python to Build a Multiple Linear Regression Model on Soccer Player Dataset.