Ctrl+K
Logo image Logo image
  • Plot types
  • Examples
  • Tutorials
  • Reference
  • User guide
  • Develop
  • Release notes
  • Plot types
  • Examples
  • Tutorials
  • Reference
  • User guide
  • Develop
  • Release notes

Section Navigation

  • Lines, bars and markers
  • Images, contours and fields
  • Subplots, axes and figures
  • Statistics
  • Pie and polar charts
  • Text, labels and annotations
  • pyplot
  • Color
  • Shapes and collections
  • Style sheets
  • axes_grid1
  • axisartist
  • Showcase
  • Animation
  • Event handling
  • Miscellaneous
  • 3D plotting
  • Scales
    • Asinh Demo
    • Loglog Aspect
    • Custom scale
    • Log Bar
    • Log Demo
    • Logit Demo
    • Exploring normalizations
    • Scales
    • Log Axis
    • Symlog Demo
  • Specialty Plots
  • Spines
  • Ticks
  • Units
  • Embedding Matplotlib in graphical user interfaces
  • Userdemo
  • Widgets

Note

Click here to download the full example code

Log Axis#

This is an example of assigning a log-scale for the x-axis using semilogx.

semilogx demo
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()

Download Python source code: semilogx_demo.py

Download Jupyter notebook: semilogx_demo.ipynb

Gallery generated by Sphinx-Gallery

© Copyright 2002–2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012–2022 The Matplotlib development team.

Created using Sphinx 5.2.3.