microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.29k stars 290 forks source link

Cropped 3D matplotlib plots #13661

Closed DavidSiretMarques closed 1 year ago

DavidSiretMarques commented 1 year ago

Environment data

Expected behaviour

I'm plotting 3D plots with matplotlib I want them to show all the axes and their labels completely.

Actual behaviour

I'm plotting 3D plots with matplotlib and the inline plots appear cropped. I've tried the sample code for a 3D scatter plot given in the matplotlib documentation, and it also appears cropped

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Download the code from matplotlib as a notebook, link here (you'll have to scroll down until you see the button to download it, it should redirect you to this link (https://matplotlib.org/stable/_downloads/03ed879008811eb700082f93269e95f9/scatter3d.ipynb)
  2. Run the code in VSCode, the plot will have the zlabel cut out, as in this StackOverflow question where I've tried different solutions, but to no avail

Logs

Output for Jupyter in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Jupyter)

``` 15:34:18.257 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd0cef6d82ed05d37ae81677be836d04edd1d422a8a481fcbb39cf98ff28921e3d8.d:\InSilicoOP-FUAM\In Silico OP\.conda\python.exe.d:\InSilicoOP-FUAM\In Silico OP\.conda\python.exe.-m#ipykernel_launcher (Python Path: d:\InSilicoOP-FUAM\In Silico OP\.conda\python.exe, Conda, 3.9.16) for '~\Downloads\scatter3d.ipynb' (disableUI=true) 15:34:18.268 [info] Process Execution: d:\InSilicoOP-FUAM\In Silico OP\.conda\python.exe -m pip list 15:34:18.283 [info] Process Execution: d:\InSilicoOP-FUAM\In Silico OP\.conda\python.exe -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)" 15:34:18.383 [info] Process Execution: d:\InSilicoOP-FUAM\In Silico OP\.conda\python.exe -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"de61404a-7960-410d-a2e9-9006b902cbec" --shell=9002 --transport="tcp" --iopub=9004 --f=c:\Users\\AppData\Roaming\jupyter\runtime\kernel-v2-569969bVbLpOVjsy2.json > cwd: ~\Downloads 15:34:19.278 [info] ipykernel version & path 6.19.2, d:\InSilicoOP-FUAM\In Silico OP\.conda\lib\site-packages\ipykernel\__init__.py for d:\InSilicoOP-FUAM\In Silico OP\.conda\python.exe 15:34:20.474 [info] Started Kernel .conda (Python 3.9.16) (pid: 33500) 15:34:20.474 [info] Started new session 893dfc20-418a-40c5-9604-26324dc03ecf ```

DavidSiretMarques commented 1 year ago

With VSCode Version: 1.79.0 (Universal) Commit: b380da4ef1ee00e224a15c1d4d9793e27c2b6302 Date: 2023-06-07T14:29:00.206Z Electron: 22.5.5 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Darwin arm64 22.5.0 Jupyter version v2023.5.1001582324 Python version v2023.10.0

The problem is still happening. See attached image image

DonJayamanne commented 1 year ago

Thanks for filing this issue and I'm sorry for not getting back any sooner on this.

If you try this exact same notebook in Jupyter Lab, you run into the same issue I.e. this isn't caused by VS Code.

Most likely an issue with matplot lib irself. Closing this as its not caused by VS Code.

DavidSiretMarques commented 1 year ago

I did try it in jupyter lab and it didn't give me the issue, that's why I opened it here...

Let me try again, to see if it's indeed a problem not caused by VS Code

DavidSiretMarques commented 1 year ago

I just run the code in jupyter lab (web version) and I cans see the 3 axes, so I think it is indeed a VS Code problem, see the image for the code

image

Whereas that same code in VS Code gives me this image:

image

DonJayamanne commented 1 year ago

Please try Jupyter lab locally, i tried that again and same result

DavidSiretMarques commented 1 year ago

I'm not going to install jupyterlab, I trust you.

Should we reopen this issue in the matplotlib repo?