Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] ideas for improving plot rendering and Python Interactive tab per se #3676

Closed
stevenlis opened this issue Jan 16, 2019 · 45 comments

Comments

@stevenlis
Copy link

vscode: 1.30.2
python extension: 2018.21.1

  1. Under the current version, if a user opens a new window with Ctrl+K O and then Run Cell in the new window. A new Python Interactive (kernel) tab will be opened aside in the window.
    Separate the code editor and the python interactive tab into two windows. This will enable the users to use different aspect ratios of the two windows and make the usage of the screen more efficient. For example, if one has a two-screen setup, put the code editor in the horizontal screen and python interactive window in the vertical one. Btw, I saw some discussion here and wonder if this is too hard to achieve now.

  2. Fix the colorization issue to increase readability of the outputs.

  3. Large plots will be automatically fitted on your screen and fully toggle it when you double click it, like Jupyter lab.

python_en2

  1. ability to adjust the Markdown text font size
@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

I don't think this is technically feasible. Not without reworking everything to use a separate node process (not a vscode webview).

Is the sole benefit of this being able to move the interactive window to a separate monitor?

@stevenlis
Copy link
Author

Just an idea and I didn't know if this will cause too many troubles. My workflow involves lots of data visualization and display the output in a vertical screen will make the work more effiecient, which is why I always use Jupyter lab in my vertaical screen.

It will also make another window themeable to increase readability like suggested in microsoft/vscode-python#3773 microsoft/vscode-python#3978 maybe?

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

I don't think this would make themeing any easier. We'd still have to use the same color theme as vscode and they don't expose this to us right now.

Theming other parts (graph backgrounds and such) would be feasible in either, although the setting of them would still be done from vscode.

@stevenlis
Copy link
Author

Maybe add a background to each cell or adjust the greyscale of each cell like this extension?

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

It should already be doing that? Are you having trouble viewing something in particular?

@stevenlis
Copy link
Author

The extension doesn't highlight any code so it doesn't really have any viewing issue and it doesn't run cells either and you need to select code manually to send code to output pane.

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

Sorry I didn't understand that at all.

You do get the 'Run cell | Run All Cells' items on top of cells, right? Or are you talking about code without '#%%' in it?

Why would you be doing send code to output pane? Is that to run it with an interpreter?

@stevenlis
Copy link
Author

stevenlis commented Jan 16, 2019

My bad. I was talking about the neuron extension. I doesn't work with python interactive window and it has its own ouput window.
image

@stevenlis
Copy link
Author

It should already be doing that? Are you having trouble viewing something in particular?

Are you talking the Python extension or? You can add a backgroud to each cell in the Pyhton Interactive tab already? Maybe I missed something?

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

The python extension should be forcing a background on the output. And we should be fixing up matplotlib so that it uses colors based on the theme.

Right now the only issue should be the code doesn't colorize correctly. I suppose a workaround for us would be to allow you to set a background color for the code.

@stevenlis
Copy link
Author

This would be great. I actually kind of like a dark theme. Will this be fixed in the next release?

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

Will this be fixed in the next release

Which 'this' are you referring to?

Colorization will get better (you can actually try it out right now with our insiders build) but still won't exactly match VS code. VS Code has an issue that prevents us from using their colors. They don't expose them.

As far as background color being settable, not sure if we'll do that or not. You should log a separate issue if you want that and other people can up vote it. Sounds useful, but maybe only because our colors don't match your theme.

@stevenlis
Copy link
Author

I just tried the insiders build and it doesn't seem any better. Is there any setting I should adjust?

image

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

First let's check if it actually installed or not. If you go to settings and type in 'DataScience', do you have something that says:

image

If that's true, what are you plotting with? Matplotlib should be picking up your theme. You can see us execute this if you go to Help | Developer Tools and look at the console output.

For me I have this in there:
Kernel: connected (6cb6bfab-27cc-4526-8234-c6c475183fec)
default.js:1430
Python Extension: Execute for %matplotlib inline
logger.ts:45
import matplotlib.pyplot as plt
from matplotlib import style
style.use('dark_background') silently finished <-- This line here should change the colors for matplotlib to work with a dark theme.

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

For example, I have the default dark theme picked and this is what I get (with the insiders build)

image

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

Ah looks like there's a bug with our matplotlib themeing. It only works if the theme has the word 'dark' in it. Doh. @IanMatthewHuff is logging an issue to fix that part.

@stevenlis
Copy link
Author

something must be wrong in my pc since I'm not getting anything like your screenshot.
image

image

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

What's your version of VS code?

@stevenlis
Copy link
Author

I reloaded the window again and now I see what you have.
image
Version: 1.30.2 (user setup)
Commit: 61122f88f0bf01e2ac16bdb9e1bc4571755f5bd8
Date: 2019-01-07T22:54:13.295Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Windows_NT x64 10.0.17763

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

Ah. Yeah we have a problem where if you change the theme the window doesn't update. That's a separate issue (#3183)

Glad it works after refresh though :)

@stevenlis
Copy link
Author

stevenlis commented Jan 16, 2019

It only works if the theme has the word 'dark' in it.

Indeed, just change the theme to "Atom Material Theme" and everything back to the colorization I had before. But it seems even with "dark" in its name, the code still doesn't get highlighted correctly under some themes.

Atom One Dark
image

Kimbie Dark
image

@rchiodo
Copy link
Contributor

rchiodo commented Jan 16, 2019

I think it's more likely that the 'Atom Material Theme' is not a default VS code theme. I don't have that one.

Do you know how you got it? Our hack for loading the vs code colors is likely not working for that one.

@stevenlis
Copy link
Author

It's not and you can downlaod it:
Atom One Dark Theme

@stevenlis
Copy link
Author

Our hack for loading the vs code colors is likely not working for that one.

Tried One Dark Theme as well and it indeed doesn't fix the colorization issue in third-party theme

@rchiodo
Copy link
Contributor

rchiodo commented Jan 17, 2019

Yeah it's installed in a different location than the default themes. Thanks. I'll enter a new bug to handle custom themes.
microsoft/vscode-python#4026

@stevenlis
Copy link
Author

٩( ᐛ )و glad to help!

Btw, It seems like the new insider build add a new feature to not fully toggle vertically long plots right? I just looked at the settings, and it doesn't seem like there is a way to set it to toggle the expanded output by default.

I assume this was added since big plots may take too many spaces right? This is actually the original reason why I opened this issue so that users can adjust the aspect ratio, but a separate window seems hard to achieve like you mention above and discussed in microsoft/vscode-python#10121.

python_en

I think there should be a setting to toggle the full ouput by defualt, right?

@rchiodo
Copy link
Contributor

rchiodo commented Jan 17, 2019

Yeah I should add a setting for that. Thanks. Sometimes you want it to show the full thing.

@rchiodo
Copy link
Contributor

rchiodo commented Jan 17, 2019

How bout like
'python.datascience.maxoutputsize': number:

Defaults to '300' but you can put -1 or any number you want. It's just a css style for us internally.

@stevenlis
Copy link
Author

It doesn't seem that I have this option:
image
Separate windows may also help some situation like this: (when you need two tab side by side like adjusting setting file)

python_en1

@rchiodo
Copy link
Contributor

rchiodo commented Jan 17, 2019

No, the setting doesn't exist yet. I'm going to add it right now (I'm changing this code as we speak).

I was asking your opinion on how you'd want it to behave.

@stevenlis
Copy link
Author

My bad. I'm sorry that I'm not famialir wtih CSS. I've used many different IDEs and I personally think Jupyter lab handles this very nice. It will automacilly fit a large plot to your screen and fully toggle it when you double click it.
python_en2

@rchiodo
Copy link
Contributor

rchiodo commented Jan 17, 2019

That sounds better. They likely check the output type before adding the scrollbar

@stevenlis stevenlis changed the title [Feature Request] Python Interactive tab in a separate window [Feature Request] ideas for improving plot rendering and Python Interactive tab per se Jan 17, 2019
@stevenlis
Copy link
Author

Great! I've edited the title and original post based on our discussion.

@stevenlis
Copy link
Author

@rchiodo Btw, will there be a setting for the Python Interactive tab to adjust the Markdown text font size? The current font size for the regular text (except headers) is way too small I think. I wish there could be a setting to adjust it independently from the code font size in the editor.

@rchiodo
Copy link
Contributor

rchiodo commented Jan 18, 2019

You're best bet for something like that would be to enter a separate issue. Eventually one of us will pull apart this issue here and add new items for each, but if you want something specific, you'd be better off entering that as a specific request.

I believe we get our markdown font/sizes from the @nteract. Not sure at the moment if we can change them or not.

@stevenlis
Copy link
Author

interesting, I was actually wondering if there could be something like Hydrogen. I will open another issue for the font size.

@dstanner
Copy link

dstanner commented Mar 4, 2019

Related to this thread, I see that there has been an update to use the matplotlib 'dark_background' theme whenever the editor is in a dark theme mode for plots in the output window.

Is there a way to change this behavior by default in VS Code?

It's fine to look at plots with the dark background in the interactive window, but it's annoying having to re-generate all of the theme settings every time I want to save a plot with a white background.

Using matplotlib canned styles doesn't seem to help either (at least with the backgrounds and font colors; see screen shot, below).

That is, can we customize whether or not this extension defaults to the dark background theme when we have a general dark theme in Code? I'd like to keep my plots with a white background/black font without having to piecemeal set parameters.

@rchiodo
Copy link
Contributor

rchiodo commented Mar 5, 2019

Well technically we fixed a bug that made this 'work' for the first time on all themes recently. This is how we intended it to always work.

This is a tough problem though. We'd need to generate the plots twice for each. One that's visible on the interactive window and one for export.

@dstanner, When you say 'save a plot with a white background' how are you saving it? Are you talking about export, or are you copying it to the clipboard?

@dstanner
Copy link

dstanner commented Mar 5, 2019

Whoops. Forgot to attach screenshot above.

Below is the example with code.
capture
I'm using savefig().

@rchiodo
Copy link
Contributor

rchiodo commented Mar 5, 2019

This is more specific than export. Can you enter a feature request/new issue? Just include your picture above.

This issue that Steven has entered is more generic. I think your needs could be met sooner if we split it out.

@dstanner
Copy link

dstanner commented Mar 5, 2019

sounds good! Thanks!

@stevenlis
Copy link
Author

stevenlis commented May 5, 2019

@rchiodo So in the python interactive window, the plot will rescale if I change the size of it as those gifs above shows. However, sometimes some packages may print out a long warning message or even a long dataframe and a scroll bar will apply at the bottom so that the plot no long auto rescale itself. Is there any solution for this issue right now?

Does this have anything to do with:
python.dataScience.maxOutputSize

I think maybe a scroll bar for those long output under those cells may be better.

vs

@rchiodo
Copy link
Contributor

rchiodo commented May 6, 2019

I believe this is a dupe of #1528.

MaxOutputSize is for the vertical size. We have no way to control the horizontal width at the moment.

@rchiodo
Copy link
Contributor

rchiodo commented May 6, 2019

I think what you're really asking for is a way to dynamically size plots no matter what else is on the screen?

@stevenlis
Copy link
Author

@rchiodo It is amazing how many works you guys have done to make everything mentioned in this issue happen. The only remaining issue is this horizontal width and seems like you've got it here
https://github.com/microsoft/vscode-python/issues/5734

@lock lock bot locked as resolved and limited conversation to collaborators Jun 14, 2019
@microsoft microsoft unlocked this conversation Nov 14, 2020
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 14, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants