Every week, we pick a real-life project to build your portfolio and get ready for a job. All projects are built with ChatGPT as co-pilot!

Start the ChallengeA tech-culture podcast where you learn to fight the enemies that blocks your way to become a successful professional in tech.

Listen the podcastPloting data in python is very similar to the process you do in linear algebra: Given a sample of X values you use a function to obtain the Y values an plot the intersection of the X and Y coordinates in the carthesian plane.

In python we use:

- The numpy package for obtaining the X and Y values.
- The pyplot module of the matplotlib library for ploting and drawing the function.

In [3]:

```
# import the python module to plot
import matplotlib.pyplot as plt
import numpy as np
```

If you don't have real data to plot, you can use numpy to generate some sample values, for example:

Here numpy will generate a list of equally distant values from -3 to +3.

In [5]:

```
x_axis = np.linspace(-3,3)
x_axis
```

Out[5]:

We can use these values as "seed" or x parameters to obtain the Y values using any linear algebra function. This is an example using the square function.

In [6]:

```
x_axis = np.linspace(-3,3)
def square(x): return x**2
y_axis = square(x_axis)
plt.plot(x_axis, y_axis)
```

Out[6]:

Data patterns can be described by algebra functions and you can plot and visualize them in charts.

The following are called the "parent functions" in linear algebra and the will usually cover 95% of your data patterns.

Here are some examples of ploting the parent functions in linear algebra, first we import numpy because it contains the functions:

In [2]:

```
import numpy as np
# start by defining a simple x axis and the Y axis will be given by our parent function
x_axis = np.linspace(-3,3,1000)
```

In [13]:

```
def square(x): return x**2
plt.plot(x_axis, square(x_axis))
```

Out[13]:

In [12]:

```
def sen_function(x): return np.sin(x)
plt.plot(x_axis, sen_function(x_axis))
```

Out[12]:

In [4]:

```
def explonential(x): return 100*(np.power(2, x))
plt.plot(x_axis, explonential(x_axis))
```

Out[4]:

In [6]:

```
def logarithmic(x): return np.log10(x)
plt.plot(x_axis, logarithmic(x_axis))
```

Out[6]: