Home » Machine Learning » Plotting » Introducing Matplotlib

Introducing Matplotlib

You can create charts and graphs in Python using Matplotlib. This can be installed easily using pip: pip install matplotlib

A simple line plot can be created with the plot function. This accepts an iterator that supplies values to be plotted.

If you don’t supply data for the x-axis, plot will create x-axis data, in the form of a sequence of integers starting at zero.

After creating a plot, you need to call the show function to prevent the graph from immediately closing.

import matplotlib.pyplot as plt

plt.plot([1, 3, 5, 2])

Leave a Reply

Blog at WordPress.com.