Let’s learn how to plot log values in Numpy and Matplotlib Python libraries.
Plotting log values
To plot log chart in Python we need to import Numpy and Matplotlib values.
Thanks to Numpy Python will create an array and calculate log values of array.
Matplotlib library will create log chart.
import numpy as np import matplotlib.pyplot as plt my_array = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) logarithm = np.log(my_array) plt.plot(my_array, logarithm) plt.show()