<jupyter_start><jupyter_text>Overview The goal of this tutorial is to provide an overview of the use of Matplotlib. Matplotlib has a vast array of functionality, so this is by no means complete. For more information, try looking at the:- [Matplotlib Homepage](http://matplotlib.org)- [Matplotlib Gallery](http://matplotlib.org/gallery.html) Matplotlib is a library that started as a way to get MATLAB-like plotting capabilities in Python. It has since evolved on its own, with a focus on publication-quality graphics. Some features- A variety of support GUI and non-interactive backends- Lines, scatter, bar- Contours, image, mesh- LaTeX-like math rendering- Animations- Basic 3D plotting  Basic Plotting Matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms.<jupyter_code># Set-up to have matplotlib use its inline backend
%matplotlib inline
# Convention for import of the pyplot interface
import matplotlib.pyplot as plt
import numpy as np
# Create some example data
x = np.linspace(0, 2, 100)
# Go ahead and explicitly create a figure and an axes
fig, ax = plt.subplots(1, 1)

# Plot our x variable on the x-axis and x^2 on the y-axis
ax.plot(x, x**2)
# Add some labels to the plot
ax.set_xlabel('x')
ax.set_ylabel('f(x)')

# Needed to reuse and see the updated plot while using inline
fig
# Let's add a title with a bit of latex syntax
ax.set_title('$y = x^2$', fontdict={'size':22})

fig
fig, ax = plt.subplots(figsize=(6, 4), dpi=100)

# Plot a set of different polynomials.
# The label argument is used when generating a legend.
ax.plot(x, x, label='$x$')
ax.plot(x, x * x, label='$x^2$')
ax.plot(x, x**3, label='$x^3$')

# Add labels and title
ax.set_xlabel('x')
ax.set_ylabel('f(x)')
ax.set_title('Polynomials')

# Add gridlines
ax.grid(True)

# Add a legend to the upper left corner of the plot
ax.legend(loc='upper left')<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup