Plot line graph from NumPy array Last Updated : 17 Dec, 2021 Comments Improve Suggest changes Like Article Like Report For plotting graphs in Python, we will use the Matplotlib library. Matplotlib is used along with NumPy data to plot any type of graph. From matplotlib we use the specific function i.e. pyplot(), which is used to plot two-dimensional data. Different functions used are explained below: np.arange(start, end): This function returns equally spaced values from the interval [start, end).plt.title(): It is used to give a title to the graph. Title is passed as the parameter to this function.plt.xlabel(): It sets the label name at X-axis. Name of X-axis is passed as argument to this function.plt.ylabel(): It sets the label name at Y-axis. Name of Y-axis is passed as argument to this function.plt.plot(): It plots the values of parameters passed to it together.plt.show(): It shows all the graph to the console. Example 1 : Python3 # importing the modules import numpy as np import matplotlib.pyplot as plt # data to be plotted x = np.arange(1, 11) y = x * x # plotting plt.title("Line graph") plt.xlabel("X axis") plt.ylabel("Y axis") plt.plot(x, y, color ="red") plt.show() Output : Example 2 : Python3 # importing the library import numpy as np import matplotlib.pyplot as plt # data to be plotted x = np.arange(1, 11) y = np.array([100, 10, 300, 20, 500, 60, 700, 80, 900, 100]) # plotting plt.title("Line graph") plt.xlabel("X axis") plt.ylabel("Y axis") plt.plot(x, y, color ="green") plt.show() Output : Comment More infoAdvertise with us Next Article Plot line graph from NumPy array V vipul1501 Follow Improve Article Tags : Python Python-numpy Python-matplotlib Practice Tags : python Similar Reads Save Plot To Numpy Array using Matplotlib Saving a plot to a NumPy array in Python is a technique that bridges data visualization with array manipulation allowing for the direct storage of graphical plots as array representations, facilitating further computational analyses or modifications within a Python environment. Let's learn how to Sa 4 min read Convert a NumPy array to an image Converting a NumPy array to an image is a simple way to turn numbers into pictures. A NumPy array holds pixel values, which are just numbers that represent colors. Images, like PNG or JPEG, store these pixel values in a format we can see. In this process, the NumPy array turns into an image, with ea 3 min read Insert a new axis within a NumPy array This post deals with the ways to increase the dimension of an array in NumPy. NumPy provides us with two different built-in functions to increase the dimension of an array i.e., 1D array will become 2D array2D array will become 3D array3D array will become 4D array4D array will become 5D arrayAdd a 4 min read Matplotlib Pyplot API Data visualization plays a key role in data science and analysis. It enables us to grasp datasets by representing them. Matplotlib, a known Python library offers a range of tools, for generating informative and visually appealing plots and charts. One outstanding feature of Matplotlib is its user-ve 4 min read How To Import Numpy As Np In this article, we will explore how to import NumPy as 'np'. To utilize NumPy functionalities, it is essential to import it with the alias 'np', and this can be achieved by following the steps outlined below. What is Numpy?NumPy stands for Numerical Python supports large arrays and matrices and can 3 min read Like