- ✕This summary was generated using AI based on multiple online sources. To view the original source information, use the "Learn more" links.
The plt.plot() function in Matplotlib is used to create 2D line plots. It connects data points with lines and allows customization of the plot’s appearance through parameters such as line styles and markers.
Example
import matplotlib.pyplot as pltimport numpy as npx = np.linspace(0, 2 * np.pi, 100)y1, y2 = np.sin(x), np.cos(x)plt.plot(x, y1, label='Sin(x)', color='b')plt.plot(x, y2, label='Cos(x)', color='r', linestyle='--')plt.xlabel('X-axis')plt.ylabel('Y-axis')plt.title('Multiple Lines Plot')plt.legend()plt.show()Copied!✕CopyCustomizing Plots
You can customize the appearance of your plots using various parameters:
Line Style and Color: Use the fmt parameter to specify the format of the plot, defining the line style, marker, and color.
Labels and Titles: Add labels and titles using xlabel(), ylabel(), and title() functions.
Markers: Customize markers using the marker parameter to specify different marker styles.
Plotting Multiple Sets of Data
Pyplot tutorial — Matplotlib 3.10.8 documentation
Please also see Quick start guide for an overview of how Matplotlib works and Matplotlib Application Interfaces (APIs) for an explanation of the trade-offs between the supported user APIs.
- alpha: float
- contains: the hit testing function
- clip_box: a matplotlib.transform.Bbox instance
See results only from matplotlib.orgExamples Gallery
Currently Matplotlib supports PyQt/PySide, PyGObject, Tkinter, and wxPython. When embedding Matplotlib in a GUI, you must use the Matplotlib API directly r…
Matplotlib Tutorial - GeeksforGeeks
Feb 24, 2026 · Matplotlib is an open-source library for creating static, animated and interactive visualizations in Python. Its object-oriented API enables the embedding of plots into applications …
Matplotlib Tutorial - W3Schools
Matplotlib is open source and we can use it freely. Matplotlib is mostly written in python, a few segments are written in C, Objective-C and Javascript for Platform …
GitHub - matplotlib/matplotlib: matplotlib: plotting with Python
- Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Pyt…
Check out our home page for more information.
- Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Pyt…
Matplotlib in Python [Beginners to Advanced Level]
Whether you’re a beginner or an advanced user, I’ve written a comprehensive tutorial on Matplotlib in Python, complete with examples. What is Matplotlib in Python?
matplotlib · PyPI
Dec 10, 2025 · Matplotlib produces publication-quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib can …
Examples — Matplotlib 3.10.8 documentation
Currently Matplotlib supports PyQt/PySide, PyGObject, Tkinter, and wxPython. When embedding Matplotlib in a GUI, you must use the Matplotlib API directly rather …
Python Plotting With Matplotlib (Guide) – Real Python
This article is a beginner-to-intermediate-level walkthrough on Python and matplotlib that mixes theory with example.
Matplotlib Tutorial - Online Tutorials Library
A beauty of the Python matplotlib library is its Python code. Its script is structured which denotes that a few lines of code are all that are required in most instances …
Data Visualization using Matplotlib in Python
3 days ago · Matplotlib is a used Python library used for creating static, animated and interactive data visualizations. It is built on the top of NumPy and it can …