# Plot in log scale of y axis in Matplotlib

The scatter() in Matplotlib pyplot plots the exponential values as follows.

import numpy as np
from matplotlib import pyplot

x = np.linspace(3, 7, 41)
y = 2 ** x

pyplot.scatter(x, y)
pyplot.savefig('normal.jpg')


If you want to set log scale of y axis, use yscale in pyplot.

import numpy as np
from matplotlib import pyplot

x = np.linspace(3, 7, 41)
y = 2 ** x

pyplot.scatter(x, y)
pyplot.yscale('log')
pyplot.savefig('log.jpg')