VOOZH about

URL: https://www.geeksforgeeks.org/python/plot-line-graph-from-numpy-array/

⇱ Plot line graph from NumPy array - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Plot line graph from NumPy array

Last Updated : 17 Dec, 2021

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 :

 
Output : 

👁 Image


Example 2 :

 
Output : 

👁 Image


 

Comment
Article Tags: