GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Plot types
  • User guide
  • Tutorials
  • Examples
  • Reference
  • Contribute
  • Releases
  • Gitter
  • Discourse
  • GitHub
  • matplotlib
  • matplotlib.animation
  • matplotlib.animation.Animation
  • matplotlib.animation.FuncAnimation

This view

  • Original page
  • New address

GeezerVison is showing matplotlib.org — matplotlib.pyplot.xlim — Matplotlib 3.11.2 documentation

matplotlib.pyplot.xlim#

matplotlib.pyplot.xlim(*args, **kwargs)[source]#

Get or set the x limits of the current Axes.

Call signatures:

left, right = xlim()  # return the current xlim
xlim((left, right))   # set the xlim to left, right
xlim(left, right)     # set the xlim to left, right

If you do not specify args, you can pass left or right as kwargs, i.e.:

xlim(right=3)  # adjust the right leaving left unchanged
xlim(left=1)  # adjust the left leaving right unchanged

Setting limits turns autoscaling off for the x-axis.

Returns:
left, right

A tuple of the new x-axis limits.

Notes

Calling this function with no arguments (e.g. xlim()) is the pyplot equivalent of calling get_xlim on the current Axes. Calling this function with arguments is the pyplot equivalent of calling set_xlim on the current Axes. All arguments are passed though.

Examples using matplotlib.pyplot.xlim#

Frame grabbing

Frame grabbing

Interactive functions

Interactive functions
On this page
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.