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
    • 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
    • Placing Colorbars
    • 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
  • pyplot
  • Color
  • Shapes and collections
  • Style sheets
  • axes_grid1
  • axisartist
  • Showcase
  • Animation
  • Event handling
  • Miscellaneous
  • 3D plotting
  • Scales
  • Specialty Plots
  • Spines
  • Ticks
  • Units
  • Embedding Matplotlib in graphical user interfaces
  • Userdemo
  • Widgets

Note

Click here to download the full example code

Axes Props#

You can control the axis tick and grid properties

axes props
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 Python source code: axes_props.py

Download Jupyter notebook: axes_props.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.