Get or set the current tick locations and labels of the y-axis. Call signatures:: locs, labels = yticks() # Get locations and labels yticks(ticks, [labels], **kwargs) # Set locations and labels Parameters ---------- ticks : array_like A lis
(ticks=None, labels=None, **kwargs)
| 1558 | |
| 1559 | |
| 1560 | def yticks(ticks=None, labels=None, **kwargs): |
| 1561 | """ |
| 1562 | Get or set the current tick locations and labels of the y-axis. |
| 1563 | |
| 1564 | Call signatures:: |
| 1565 | |
| 1566 | locs, labels = yticks() # Get locations and labels |
| 1567 | |
| 1568 | yticks(ticks, [labels], **kwargs) # Set locations and labels |
| 1569 | |
| 1570 | Parameters |
| 1571 | ---------- |
| 1572 | ticks : array_like |
| 1573 | A list of positions at which ticks should be placed. You can pass an |
| 1574 | empty list to disable yticks. |
| 1575 | |
| 1576 | labels : array_like, optional |
| 1577 | A list of explicit labels to place at the given *locs*. |
| 1578 | |
| 1579 | **kwargs |
| 1580 | :class:`.Text` properties can be used to control the appearance of |
| 1581 | the labels. |
| 1582 | |
| 1583 | Returns |
| 1584 | ------- |
| 1585 | locs |
| 1586 | An array of label locations. |
| 1587 | labels |
| 1588 | A list of `.Text` objects. |
| 1589 | |
| 1590 | Notes |
| 1591 | ----- |
| 1592 | Calling this function with no arguments (e.g. ``yticks()``) is the pyplot |
| 1593 | equivalent of calling `~.Axes.get_yticks` and `~.Axes.get_yticklabels` on |
| 1594 | the current axes. |
| 1595 | Calling this function with arguments is the pyplot equivalent of calling |
| 1596 | `~.Axes.set_yticks` and `~.Axes.set_yticklabels` on the current axes. |
| 1597 | |
| 1598 | Examples |
| 1599 | -------- |
| 1600 | Get the current locations and labels: |
| 1601 | |
| 1602 | >>> locs, labels = yticks() |
| 1603 | |
| 1604 | Set label locations: |
| 1605 | |
| 1606 | >>> yticks(np.arange(0, 1, step=0.2)) |
| 1607 | |
| 1608 | Set text labels: |
| 1609 | |
| 1610 | >>> yticks(np.arange(5), ('Tom', 'Dick', 'Harry', 'Sally', 'Sue')) |
| 1611 | |
| 1612 | Set text labels and properties: |
| 1613 | |
| 1614 | >>> yticks(np.arange(12), calendar.month_name[1:13], rotation=45) |
| 1615 | |
| 1616 | Disable yticks: |
| 1617 |
nothing calls this directly
no test coverage detected