Note
Click here to download the full example code
This is an example of assigning a log-scale for the x-axis using
semilogx
.
Traceback (most recent call last):
File "/build/matplotlib-tq5J6U/matplotlib-3.1.2/examples/scales/log_test.py", line 1
========
^
SyntaxError: invalid syntax
========
Log Axis
========
This is an example of assigning a log-scale for the x-axis using
`semilogx`.
"""
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
dt = 0.01
t = np.arange(dt, 20.0, dt)
ax.semilogx(t, np.exp(-t / 5.0))
ax.grid()
plt.show()
Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery