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.10.7+dfsg1 documentation - Home Matplotlib 3.10.7+dfsg1 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
    • Align labels and titles
    • Programmatically control subplot adjustment
    • Axes box aspect
    • Axes Demo
    • Controlling view limits using margins and sticky_edges
    • Axes properties
    • Axes zoom effect
    • Draw regions that span an Axes
    • Equal axis aspect ratio
    • Axis label position
    • Broken axis
    • Custom Figure subclasses
    • Resize Axes with constrained layout
    • Resize Axes with tight layout
    • Different scales on the same Axes
    • Figure size in different units
    • Figure labels: suptitle, supxlabel, supylabel
    • Adjacent subplots
    • Geographic Projections
    • Combine two subplots using subplots and GridSpec
    • GridSpec with variable sizes and spacing
    • Gridspec for multi-column/row subplot layouts
    • Nested Gridspecs
    • Inverted axis
    • Manage multiple figures in pyplot
    • Secondary Axis
    • Share axis limits and views
    • Shared axis
    • Figure subfigures
    • Multiple subplots
    • subplot2grid
    • Subplots spacings and margins
    • Create 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 properties

Note

Go to the end to download the full example code.

Axes properties#

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–2026 The Matplotlib development team.

Created using Sphinx 8.1.3.

Built from 3.10.7+dfsg1.

Built with the PyData Sphinx Theme 0.16.1.