iPython 셸에서 인라인으로 플롯할 수 없음(터미널 및 VScode 터미널 창) (Can't plot inline in iPython shell (Terminal and VScode terminal window))


문제 설명

iPython 셸에서 인라인으로 플롯할 수 없음(터미널 및 VScode 터미널 창) (Can't plot inline in iPython shell (Terminal and VScode terminal window))

iPython 셸인라인 및 외부에서 플롯하지 않는 이유를 이해하도록 도와줄 사람이 있습니까? 대신 창? Jupyter 노트북에 대해 말하는 것이 아닙니다. 나는 그 일을 했다. 도움을 주시면 감사하겠습니다. 감사합니다 ...

물론 제 문제를 해결하기 위해 여러 소스를 시도했습니다.

  • Stackoverflow: ‑> 작동하지 않음
  • matplotlib.org ‑> 동일
  • ipython 문서 ‑> 동일
  • Google에서 제안한 다른 몇 개 ‑> 동일
(py310_env) Murat ~ % ipython                   
Python 3.10.0 (default, Nov 10 2021, 11:24:47) [Clang 12.0.0 ]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.1.1 ‑‑ An enhanced Interactive Python. Type '?' for help.

The following code will plot, but **not inline**:

In [1]: import matplotlib.pyplot as plt

In [2]: import numpy

In [3]: %matplotlib
Using matplotlib backend: MacOSX

In [4]: plt.plot([0,1,4,9,16])
Out[4]: [<matplotlib.lines.Line2D at 0x7f7821f3cfa0>]

이 문장도 시도했습니다.

`%matplotlib inline´

이 문장을 시도하면, 그런 다음 플롯의 외부 표시조차 하지 않는 다음과 같은 결과를 얻었습니다.

In [6]: plt.plot([0,1,4,9,16])
Out[6]: [<matplotlib.lines.Line2D at 0x7f7823002020>]
<Figure size 432x288 with 1 Axes>

내 백엔드가 그렇게 변경되어야 한다고 생각했습니다. 해봤는데 안바꿔요.

In [8]: %matplotlib qt
Warning: Cannot change to a different GUI toolkit: qt. Using osx instead.

In [9]: matplotlib tk
Warning: Cannot change to a different GUI toolkit: tk. Using osx instead.

참조 솔루션

방법 1:

Unless someone suggests a better solution, here is my cure.

Initially I had been trying to invoke ipython in the CLI using the command %ipython.

My conclusion is now, you need to use Jupyter Qt‑console (available in the Anaconda distro. (Spyder, Jupyter and PyQT are preinstalled)

%jupyter qtconsole : QT will open up Terminal style console for Python and it does the inline plot magic.

(by muritzmuritz)

참조 문서

  1. Can't plot inline in iPython shell (Terminal and VScode terminal window) (CC BY‑SA 2.5/3.0/4.0)

#visual-studio-code #ipython #matplotlib






관련 질문

TypeScript, VSCode: vscode의 내부 버전으로 전환할 때 keyof 유형이 예상대로 작동하지 않습니다. (TypeScript, VSCode: keyof type not working as expected when switching to insider version of vscode)

Visual Studio Code가 이상하게 작동합니다. (Visual Studio Code acts weird)

거짓 긍정 "연결할 수 없는 코드가 감지되었습니다.ts(7027)"? (False positive "Unreachable code detected.ts(7027)"?)

미니맵에서 Visual Studio Code 하이라이트 선택(스크롤바 아님) (Visual Studio Code highlight selection on minimap (not scrollbar))

소품과 값 사이에 공백을 적용하기 위한 Sass linting 규칙이 VS Code에서 잘못 작동합니까? (Is the Sass linting rule for enforcing a space between the prop and value working incorrectly with VS Code?)

VSCode(Mac) 2020의 C++ std_lib_facilities.h 파일 (C++ std_lib_facilities.h file in VSCode (Mac) 2020)

pytest를 사용하여 VSCODE에서 python 테스트 설정 문제 (Issues setting up python testing in VSCODE using pytest)

Coderunner 문제 Mac (Coderunner issues Mac)

디버깅 작업 전환을 위한 VisualStudio Code 바로 가기 키 (VisualStudio Code shortcut key for switching debugging task)

vs 코드에서 PHP 자동 완성이 작동하지 않습니다 (PHP auto complete in vs code doesn't work)

VSCode powershell 함수 서명 인텔리센스 제안 (VSCode powershell function signature intellisense suggestions)

iPython 셸에서 인라인으로 플롯할 수 없음(터미널 및 VScode 터미널 창) (Can't plot inline in iPython shell (Terminal and VScode terminal window))







코멘트