Chapter 7 - 7.12 More Plotting PDF

Title Chapter 7 - 7.12 More Plotting
Author Kyle Frudakis
Course Python Programming
Institution Florida Atlantic University
Pages 2
File Size 120.4 KB
File Type PDF
Total Downloads 2
Total Views 140

Summary

Learn how to plot in different ways
how to plot data more specifically...


Description

Chapter 7 - 7.12 More Plotting Wednesday, June 16, 2021

2:45 PM

Pylab Arrays • an important component of the pylab module is another Python module called numpy ○ short for "numeric python" ○ provides the following capabilities 1. a new data type, the array object 2. support for floating-point data types to interacting with arrays 3. support functions for floating-point values interacting with arrays • The array datatype ant its associated methods and functions is particularly useful • Pylab works with arrays, not lists ○ if you provide a list as an argument, pylab converts it to an array • Arrays are similar to lists ○ sequence data structure ○ mutable ○ responds to index assignments • Arrays can only hold one data type ○ default is floating-point number • we can use the array constructor ○ can turn a list to an array ○ list must consist of only numbers ▪ if there are ints, they will be turned to floats • arange does the same thing as range ○ values are floating-point instead of integers ○ takes 3 arguments 1. begin value (float) 2. end value (float) 3. increment (float) • An alternative to arange is the pylab method linspace ○ In arange, you specify how far apart you want the values ○ in linspace, you specify how many values you want



• There are a lot of overloaded operators for arrays ○ when you multiple an array by a floating number, then every element of the array will be multiplicated by that number >>> new_array = pylab.arange(0,2,0.1) >>> new_array array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. , 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9]) >>> new_array * 0.5 array([0. , 0.05, 0.1 , 0.15, 0.2 , 0.25, 0.3 , 0.35, 0.4 , 0.45, 0.5 ,

0.55, 0.6 , 0.65, 0.7 , 0.75, 0.8 , 0.85, 0.9 , 0.95])

>>> Plotting Trigonometric Functions • knowing about arrays makes it a lot easier to create graphs...


Similar Free PDFs