Matplotlib's object-oriented interface allows us to access individual components of the plot, like axes, and set specific attributes on these components. But our plot with an inset curve is more complicated than just a plot with two lines- we are going to add an inset curve. For a simple plot, the pyplot interface above is sufficient. The plot from a previous post, was constructed using Matplotlib's pyplot interface. To build our inset curve, we will use Python and Matplotlib's object-oriented interface. On our stress-strain curve, the inset curve will show a zoomed-in view of the linear elastic region on the plot. To begin this course, we will be using the pyplot module, which is typically imported under the alias plt. Inset curves usually show a zoomed-in view of a larger plot. Matplotlib has a variety of modules available for import. An inset curve is a small plot that is placed on top of the main plot. We are going to add an inset curve on top of our stress-strain curve that highlights the linear elastic region. Stress-strain curves are used by engineers to demonstrate how a material deforms under stress. The type of plot we are building is called a stress-strain curve.
HOW TO INSTALL MATPLOTLIB PYTHON INSTALL
You can install Matplotlib, NumPy, and Pandas with the Anaconda Prompt using the commands below: Pandas, a Python library for working with tabular data, will help us bring the data into our Python program. We'll use NumPy to make a few calculations. NumPy is a Python library for numeric computation. If you installed Python from somewhere else, you'll need to install Matplotlib. If you installed Anaconda, Matplotlib is already installed. Matplotlib is one of the most popular Python plotting libraries. Matplotlib, NumPy, and Pandas - We'll build our inset curve using a Python plotting library called Matplotlib.
HOW TO INSTALL MATPLOTLIB PYTHON HOW TO
See this post to see how to install Anaconda on your computer. I recommend installing the Anaconda Distribution of Python. Python - You need to have Python installed on your computer. While it's possible to create the inset curve with a Chromebook, tablet, or phone - that's a bit more complicated and beyond the scope of this post. A laptop or desktop computer will both work. In order to build an inset curve with Matplotlib, you'll need to have a couple of things in place:Ĭomputer - to recreate the inset curve in this post, you'll need a computer.