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 *lef
(*args, **kwargs)
| 1407 | |
| 1408 | |
| 1409 | def xlim(*args, **kwargs): |
| 1410 | """ |
| 1411 | Get or set the x limits of the current axes. |
| 1412 | |
| 1413 | Call signatures:: |
| 1414 | |
| 1415 | left, right = xlim() # return the current xlim |
| 1416 | xlim((left, right)) # set the xlim to left, right |
| 1417 | xlim(left, right) # set the xlim to left, right |
| 1418 | |
| 1419 | If you do not specify args, you can pass *left* or *right* as kwargs, |
| 1420 | i.e.:: |
| 1421 | |
| 1422 | xlim(right=3) # adjust the right leaving left unchanged |
| 1423 | xlim(left=1) # adjust the left leaving right unchanged |
| 1424 | |
| 1425 | Setting limits turns autoscaling off for the x-axis. |
| 1426 | |
| 1427 | Returns |
| 1428 | ------- |
| 1429 | left, right |
| 1430 | A tuple of the new x-axis limits. |
| 1431 | |
| 1432 | Notes |
| 1433 | ----- |
| 1434 | Calling this function with no arguments (e.g. ``xlim()``) is the pyplot |
| 1435 | equivalent of calling `~.Axes.get_xlim` on the current axes. |
| 1436 | Calling this function with arguments is the pyplot equivalent of calling |
| 1437 | `~.Axes.set_xlim` on the current axes. All arguments are passed though. |
| 1438 | """ |
| 1439 | ax = gca() |
| 1440 | if not args and not kwargs: |
| 1441 | return ax.get_xlim() |
| 1442 | ret = ax.set_xlim(*args, **kwargs) |
| 1443 | return ret |
| 1444 | |
| 1445 | |
| 1446 | def ylim(*args, **kwargs): |