microsoft / vscode-jupyter

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

Images render too large #7397

Closed david-cortes closed 3 years ago

david-cortes commented 3 years ago

When rendering images in a jupyter notebook (from matplotlib for example), these images look much bigger in vscode than in nbviewer or github’s jupyter viewer.

Example (see the image at the end): https://nbviewer.jupyter.org/github/david-cortes/contextualbandits/blob/master/example/online_contextual_bandits.ipynb https://github.com/david-cortes/contextualbandits/blob/master/example/online_contextual_bandits.ipynb

VSCode version: 1.60.0 Jupyter extension version: v2021.8.2031190714 OS: linux (debian)

DonJayamanne commented 3 years ago

Thanks for filing this issue. I've tested this, and nbviewer has a max width, hence no matter what kind of a monitor you have the width of the notebook is restricted. Same applies to the GitHub notebook viewer.

The notebooks in VS Code dont have a width restriction,a s VS Code provides editing of notebooks and doesn't restrict the width of the Editors (nbviewer & github viewer are readonly and built purely for vewing of notebooks - i.e. a readonly experience).

You can however try the centered layout option in VS Code, use the command View: Toggle Centered Layout. Also, if you resize VS Code you'll notice the images scale accordingly, this shows that the images are scaled based on the realstate available (as opposed to restricting the width).

I believe the best options at this stage is to use the Toggle Centered Layout (and resize the editor area as you see fit)

DonJayamanne commented 3 years ago

Please do let me know if the above option works for you.