matplotlib

Supporting Libraries / Dependencies

To work with matplotlib, verify that the Python environment has the supporting libraries installed either via pip or through the Anaconda distribution, which should install them as part of the matplotlib package automatically.

Required Libraries:

  • cycler
  • freetype
  • kiwisolver
  • libtiff
  • lz4-c
  • matplotlib-base
  • olefile
  • pillow
  • tk
  • xz
  • zstd

Extensions

Basemap

Matplotlib has a basemap extension that can be used for static geographical plotting, though plotly is better suited with its interactive opportunities with geographical plotting.

Functionality

Magic Functions

The following magic function is used to interact with Matplotlib plots within an IPython-supported notebook, such as the Jupyter kernel (Python shell), which uses IPython as its backend. Basically, it displays plots 'inline' within the notebook.

%mtaplotlib inline

Source: https://ipython.readthedocs.io/en/stable/interactive/tutorial.html#magics-explained

In other cases, the following would be called to display a plot

plt.show()

References

Plot Look Dev

Legend Location Codes: https://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.legend

Named Color Codes: https://matplotlib.org/3.3.3/gallery/color/named_colors.html

Line Style Reference: https://matplotlib.org/gallery/lines_bars_and_markers/line_styles_reference.html

Marker Symbol Codes: https://matplotlib.org/api/markers_api.html

Quick Reference

Documentation

The gallery (Example) section of the website includes many examples of graphs and relevant code to generate them.