Skip to main content
Ctrl+K
You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Matplotlib 3.8.3 documentation - Home Matplotlib 3.8.3 documentation - Home
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Twitter
  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • Twitter

Section Navigation

  • Lines, bars and markers
  • Images, contours and fields
  • Subplots, axes and figures
    • Aligning Labels
    • Programmatically controlling subplot adjustment
    • Axes box aspect
    • Axes Demo
    • Controlling view limits using margins and sticky_edges
    • Axes Props
    • Axes Zoom Effect
    • axhspan Demo
    • Equal axis aspect ratio
    • Axis Label Position
    • Broken Axis
    • Custom Figure subclasses
    • Resizing axes with constrained layout
    • Resizing axes with tight layout
    • Different scales on the same axes
    • Figure size in different units
    • Figure labels: suptitle, supxlabel, supylabel
    • Creating adjacent subplots
    • Geographic Projections
    • Combining two subplots using subplots and GridSpec
    • Using Gridspec to make multi-column/row subplot layouts
    • Nested Gridspecs
    • Invert Axes
    • Managing multiple figures in pyplot
    • Secondary Axis
    • Sharing axis limits and views
    • Shared axis
    • Figure subfigures
    • Multiple subplots
    • Subplots spacings and margins
    • Creating multiple subplots using plt.subplots
    • Plots with different scales
    • Zoom region inset axes
  • Statistics
  • Pie and polar charts
  • Text, labels and annotations
  • Color
  • Shapes and collections
  • Style sheets
  • Module - pyplot
  • Module - axes_grid1
  • Module - axisartist
  • Showcase
  • Animation
  • Event handling
  • Miscellaneous
  • 3D plotting
  • Scales
  • Specialty plots
  • Spines
  • Ticks
  • Units
  • Embedding Matplotlib in graphical user interfaces
  • Widgets
  • Userdemo
  • Examples
  • Subplots, axes and figures
  • Axes Props

Note

Go to the end to download the full example code

Axes Props#

You can control the axis tick and grid properties

import matplotlib.pyplot as plt
import numpy as np

t = np.arange(0.0, 2.0, 0.01)
s = np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s)

ax.grid(True, linestyle='-.')
ax.tick_params(labelcolor='r', labelsize='medium', width=3)

plt.show()

Download Jupyter notebook: axes_props.ipynb

Download Python source code: axes_props.py

Gallery generated by Sphinx-Gallery

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

Created using Sphinx 8.1.3.

Built from 3.8.3.

Built with the PyData Sphinx Theme 0.16.1.