Return the value of an `.Artist`'s *property*, or print all of them. Parameters ---------- obj : `~matplotlib.artist.Artist` The queried artist; e.g., a `.Line2D`, a `.Text`, or an `~.axes.Axes`. property : str or None, default: None If *property* is 'somename'
(obj, property=None)
| 1790 | |
| 1791 | |
| 1792 | def getp(obj, property=None): |
| 1793 | """ |
| 1794 | Return the value of an `.Artist`'s *property*, or print all of them. |
| 1795 | |
| 1796 | Parameters |
| 1797 | ---------- |
| 1798 | obj : `~matplotlib.artist.Artist` |
| 1799 | The queried artist; e.g., a `.Line2D`, a `.Text`, or an `~.axes.Axes`. |
| 1800 | |
| 1801 | property : str or None, default: None |
| 1802 | If *property* is 'somename', this function returns |
| 1803 | ``obj.get_somename()``. |
| 1804 | |
| 1805 | If it's None (or unset), it *prints* all gettable properties from |
| 1806 | *obj*. Many properties have aliases for shorter typing, e.g. 'lw' is |
| 1807 | an alias for 'linewidth'. In the output, aliases and full property |
| 1808 | names will be listed as: |
| 1809 | |
| 1810 | property or alias = value |
| 1811 | |
| 1812 | e.g.: |
| 1813 | |
| 1814 | linewidth or lw = 2 |
| 1815 | |
| 1816 | See Also |
| 1817 | -------- |
| 1818 | setp |
| 1819 | """ |
| 1820 | if property is None: |
| 1821 | insp = ArtistInspector(obj) |
| 1822 | ret = insp.pprint_getters() |
| 1823 | print('\n'.join(ret)) |
| 1824 | return |
| 1825 | return getattr(obj, 'get_' + property)() |
| 1826 | |
| 1827 | # alias |
| 1828 | get = getp |
nothing calls this directly
no test coverage detected
searching dependent graphs…