나는 R에서 "function_name"을 입력 할 수 있음을 알고 있습니다. 어떻게 파이썬에서 이것을합니까? 특히 pyplot
라이브러리에서 set_position
에 대한 정보를 찾으려고합니다.파이썬에서 함수에 대한 정보를 찾는 방법은 무엇입니까?
5
A
답변
8
help(function)
트릭을해야합니다.
데모 : ipython
에서
def func():
"""
I am a function who doesn't do anything,
I just sit in your namespace and crowd it up.
If you call me expecting anything
I'll just return to you the singleton None
"""
pass
help(func)
2
의 supereasy - 단지 문제의 함수 (소스 코드와 함께 확장 된 정보를 원하시면 또는 ??
) ?
를 추가합니다. matplotlib
에서 대화식으로 작업 할 때
난 항상 그것을 사용 :
In [2]: from matplotlib.axes import Axes
In [3]: Axes.set_position??
Type: instancemethod
String Form:<unbound method Axes.set_position>
File: /home/tzelleke/.local/modules/active_python_2.7/lib/python2.7/site-packages/matplotlib/axes.py
Definition: Axes.set_position(self, pos, which='both')
Source:
def set_position(self, pos, which='both'):
"""
Set the axes position with::
pos = [left, bottom, width, height]
in relative 0,1 coords, or *pos* can be a
:class:`~matplotlib.transforms.Bbox`
There are two position variables: one which is ultimately
used, but which may be modified by :meth:`apply_aspect`, and a
second which is the starting point for :meth:`apply_aspect`.
Optional keyword arguments:
*which*
========== ====================
value description
========== ====================
'active' to change the first
'original' to change the second
'both' to change both
========== ====================
"""
if not isinstance(pos, mtransforms.BboxBase):
pos = mtransforms.Bbox.from_bounds(*pos)
if which in ('both', 'active'):
self._position.set(pos)
if which in ('both', 'original'):
self._originalPosition.set(pos)
In [4]:
3
, ipython
에서 실행 해보십시오 경우에 입력 할 수 있습니다
In [1]: from matplotlib import pyplot as pl
In [2]: pl.set_position?
Object `pl.set_position` not found.
를 여기에서 찾아 google을 사용해야합니다 그 set_position
은 Axes
클래스의 메소드입니다 :
In [3]: pl.Axes.set_position?
Type: instancemethod
String Form:<unbound method Axes.set_position>
File: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/axes.py
Definition: pl.Axes.set_position(self, pos, which='both')
Docstring:
Set the axes position with::
pos = [left, bottom, width, height]
in relative 0,1 coords, or *pos* can be a
:class:`~matplotlib.transforms.Bbox`
There are two position variables: one which is ultimately
used, but which may be modified by :meth:`apply_aspect`, and a
second which is the starting point for :meth:`apply_aspect`.
Optional keyword arguments:
*which*
========== ====================
value description
========== ====================
'active' to change the first
'original' to change the second
'both' to change both
========== ====================
관련 문제
- 1. 파이썬에서 'posix'모듈을 찾는 방법은 무엇입니까?
- 2. 파이썬에서 함수에 대한 EBNF
- 3. PowerShell에서 정보를 찾는 방법은 무엇입니까?
- 4. 익명 함수에 대한 크롬 디버거에서 클로저를 찾는 방법은 무엇입니까?
- 5. 다운로드 한 항목 정보를 찾는 방법은 무엇입니까?
- 6. 함수에 포함되지 않은 Javascript를 찾는 방법은 무엇입니까?
- 7. MySQL 오류에 대한 자세한 정보를 찾는 방법은 무엇입니까?
- 8. 주어진 MySQL 프로세스에 대한 자세한 정보를 찾는 방법은 무엇입니까?
- 9. 내가 연결된 네트워크에 대한 고급 정보를 찾는 방법은 무엇입니까?
- 10. bash에서 매크로에 대한 세부 정보를 찾는 쉬운 방법은 무엇입니까?
- 11. 도메인 주소를 사용하여 회사에 대한 Facebook 정보를 찾는 방법은 무엇입니까?
- 12. IIS에서 mysql에 대한 연결 문자열 세부 정보를 찾는 방법은 무엇입니까?
- 13. Android API에 대한 이전 변경 정보를 찾는 방법은 무엇입니까?
- 14. 실행중인 프로세스 세부 정보를 찾는 방법은 무엇입니까?
- 15. QR 코드에서 타이밍 정보를 찾는 방법은 무엇입니까?
- 16. Magento 신용 카드 정보를 찾는 방법은 무엇입니까?
- 17. 파이썬에서 올바른 인코딩을 찾는 방법은 무엇입니까?
- 18. 파이썬에서 파일을 위쪽으로 찾는 방법은 무엇입니까?
- 19. 파이썬에서 문자열 내에서 문자열을 찾는 방법은 무엇입니까?
- 20. 파이썬에서 사각형 교차 부분을 찾는 방법은 무엇입니까?
- 21. 파이썬에서 바운드 메소드의 인스턴스를 찾는 방법은 무엇입니까?
- 22. 파이썬에서 큰 수의 제곱근을 찾는 방법은 무엇입니까?
- 23. 파이썬에서 다른 함수에 대한 테스트 함수 만들기
- 24. 선언되지 않은 변수는 파이썬에서 함수에 대한 참조입니까?
- 25. 함수에 대한 Java SDK 버전을 찾는 방법
- 26. UNIX 시스템에서 CPU에 대한 정보를 찾는 명령
- 27. Sybase DB에 대한 연결 정보를 찾는 방법
- 28. 파이썬에서 개별 파일의 함수에 전역 변수를 사용하는 방법은 무엇입니까?
- 29. 멤버 함수에 대한 포인터를 C 함수에 전달하는 방법은 무엇입니까?
- 30. PhpStorm에서 함수에 대한 주석을 쓰는 방법은 무엇입니까?
그래서 plplot을 plt로 가져옵니다. 내 플롯의 위치를 조정하고 싶습니다. help (pl.set_position) 또는 help (set_position)을 입력하면 오류 메시지가 나타납니다. – lord12
@ lord12 - 왜냐하면'plt.set_position'이 존재하지 않기 때문입니다 ... 처음부터 함수를 어디에서 찾을 지 알아야합니다. – mgilson
문서 문자열의 마지막 줄을 더 잘 작성하는 방법에 대한 제안 수락 --- http://www.youtube.com/watch?v=XaWU1CmrJNc – mgilson