Get or set the y-limits of the current axes. Call signatures:: bottom, top = ylim() # return the current ylim ylim((bottom, top)) # set the ylim to bottom, top ylim(bottom, top) # set the ylim to bottom, top If you do not specify args, you can alternati
(*args, **kwargs)
| 1444 | |
| 1445 | |
| 1446 | def ylim(*args, **kwargs): |
| 1447 | """ |
| 1448 | Get or set the y-limits of the current axes. |
| 1449 | |
| 1450 | Call signatures:: |
| 1451 | |
| 1452 | bottom, top = ylim() # return the current ylim |
| 1453 | ylim((bottom, top)) # set the ylim to bottom, top |
| 1454 | ylim(bottom, top) # set the ylim to bottom, top |
| 1455 | |
| 1456 | If you do not specify args, you can alternatively pass *bottom* or |
| 1457 | *top* as kwargs, i.e.:: |
| 1458 | |
| 1459 | ylim(top=3) # adjust the top leaving bottom unchanged |
| 1460 | ylim(bottom=1) # adjust the bottom leaving top unchanged |
| 1461 | |
| 1462 | Setting limits turns autoscaling off for the y-axis. |
| 1463 | |
| 1464 | Returns |
| 1465 | ------- |
| 1466 | bottom, top |
| 1467 | A tuple of the new y-axis limits. |
| 1468 | |
| 1469 | Notes |
| 1470 | ----- |
| 1471 | Calling this function with no arguments (e.g. ``ylim()``) is the pyplot |
| 1472 | equivalent of calling `~.Axes.get_ylim` on the current axes. |
| 1473 | Calling this function with arguments is the pyplot equivalent of calling |
| 1474 | `~.Axes.set_ylim` on the current axes. All arguments are passed though. |
| 1475 | """ |
| 1476 | ax = gca() |
| 1477 | if not args and not kwargs: |
| 1478 | return ax.get_ylim() |
| 1479 | ret = ax.set_ylim(*args, **kwargs) |
| 1480 | return ret |
| 1481 | |
| 1482 | |
| 1483 | def xticks(ticks=None, labels=None, **kwargs): |