matplotlib.pyplot.ylim#

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

Get or set the y-limits of the current axes.

Call signatures:

bottom,top=ylim()# return the current ylimylim((bottom,top))# set the ylim to bottom, topylim(bottom,top)# set the ylim to bottom, top

If you do not specify args, you can alternatively passbottom ortop as kwargs, i.e.:

ylim(top=3)# adjust the top leaving bottom unchangedylim(bottom=1)# adjust the bottom leaving top unchanged

Setting limits turns autoscaling off for the y-axis.

Returns
bottom, top

A tuple of the new y-axis limits.

Notes

Calling this function with no arguments (e.g.ylim()) is the pyplotequivalent of callingget_ylim on the current axes.Calling this function with arguments is the pyplot equivalent of callingset_ylim on the current axes. All arguments are passed though.

Examples usingmatplotlib.pyplot.ylim#

Infinite lines

Infinite lines

Infinite lines
Pyplot Text

Pyplot Text

Pyplot Text
Frame grabbing

Frame grabbing

Frame grabbing
Interactive functions

Interactive functions

Interactive functions
Findobj Demo

Findobj Demo

Findobj Demo
Pyplot tutorial

Pyplot tutorial

Pyplot tutorial