Arrays and Plotting [chapter]

Joakim Sundnes
2020 Introduction to Scientific Programming with Python  
In this chapter, we will learn to visualize mathematical functions and the results of mathematical calculations. You have probably used a variety of different plotting tools in the past, and we will now do much of the same thing in Python. The way standard plotting tools work in Python is that we first compute a number of points lying on the curve we want to show and then draw straight lines between them. If we have enough points, the result looks like a smooth curve. For plotting mathematical
more » ... tting mathematical functions, this approach can seem a bit primitive, since there are other tools we can use to simply type in a mathematical expression and have the curve plotted on the screen. However, the approach we use here is also much more flexible, since we can plot data when there is no underlying mathematical function, for instance, experimental data read from a file or results from a numerical experiment. To plot functions in Python, we need to learn about the package matplotlib, which is an extensive toolbox for plotting and visualization. In addition, it is useful to introduce the package named NumPy, which is useful for storing storing arrays of data for efficient computations.
doi:10.1007/978-3-030-50356-7_6 fatcat:taec2wbpxzdxzdvepzl45uevcq