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

When using the RStudio IDE to run Python: Seaborn plots not working #29

Open
tomwagstaff-opml opened this issue Jan 31, 2023 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@tomwagstaff-opml
Copy link

Hi guys,

As reported before, the Seaborn-based plots don't seem to be working in a Python 3.10 environment on my Windows machine e.g. this line from the quick start: adjusted.covars().plot(library = "seaborn", dist_type = "kde"). It doesn't throw an error, just doesn't output any plots.

Here is my session info as requested by @talgalili - hope it helps!

-----
balance             0.3.0
pandas              1.4.3
session_info        1.0.0
-----
IPython             8.9.0
PIL                 9.4.0
asttokens           NA
backcall            0.2.0
beta_ufunc          NA
binom_ufunc         NA
coxnet              NA
cvcompute           NA
cvelnet             NA
cvfishnet           NA
cvglmnet            NA
cvglmnetCoef        NA
cvglmnetPredict     NA
cvlognet            NA
cvmrelnet           NA
cvmultnet           NA
cycler              0.10.0
cython_runtime      NA
dateutil            2.8.2
decorator           5.1.1
elnet               NA
executing           1.2.0
fishnet             NA
glmnet              NA
glmnetCoef          NA
glmnetControl       NA
glmnetPredict       NA
glmnetSet           NA
glmnet_python       NA
hypergeom_ufunc     NA
jedi                0.18.2
joblib              1.2.0
kiwisolver          1.4.4
loadGlmLib          NA
lognet              NA
matplotlib          3.6.3
mpl_toolkits        NA
mrelnet             NA
nbinom_ufunc        NA
nt                  NA
numpy               1.24.1
packaging           23.0
parso               0.8.3
patsy               0.5.3
pickleshare         0.7.5
pkg_resources       NA
plotly              5.13.0
prompt_toolkit      3.0.36
pure_eval           0.2.2
pygments            2.14.0
pyparsing           3.0.9
pytz                2022.7.1
rpycall             NA
rpytools            NA
scipy               1.8.1
seaborn             0.11.1
setuptools          65.6.3
six                 1.16.0
sklearn             1.2.1
stack_data          0.6.2
statsmodels         0.13.5
tenacity            NA
threadpoolctl       3.1.0
traitlets           5.9.0
wcwidth             0.2.6
wtmean              NA
-----
Python 3.10.9 | packaged by conda-forge | (main, Jan 11 2023, 15:15:40) [MSC v.1916 64 bit (AMD64)]
@talgalili
Copy link
Contributor

Thanks for the report @tomwagstaff-opml

This is very odd, since I see that your python is 3.10.9, IPython 8.9.0, and seaborn 0.11.1, which is similar to what's used by gh actions (python is 3.10.6, IPython 8.9.0, and seaborn 0.11.1):
https://import-balance.org/docs/tutorials/quickstart/

So it's not clear to me why this happens for you.

@stevemandala are you able to reproduce the issue with the seaborn plots on your machine?

@stevemandala
Copy link

I gave the tutorial a run in my Windows-based jupyter instance, but I wasn't able to repro the plotting issue from jupyter; plots seemed to output as expected.

Curious if this is an issue on the balance side or with the Seaborn plotting itself. @tomwagstaff-opml Do sample Seaborn plots like the one below work for you?

import seaborn as sns
penguins = sns.load_dataset("penguins")
sns.histplot(data=penguins, x="flipper_length_mm", hue="species", multiple="stack")

@talgalili talgalili added the bug Something isn't working label Feb 1, 2023
@tomwagstaff-opml
Copy link
Author

Hi @stevemandala,

Sorry for the delay in replying, I'm afraid I ran out of time to devote to this.
The issue here might be that I'm using the RStudio IDE to run Python. When I ran your code I just got the description of the object on the console: <AxesSubplot: xlabel='flipper_length_mm', ylabel='Count'>

However, when I added these 2 lines:

import matplotlib.pyplot as plt
plt.show()

Then your example appeared in my plot pane.

@talgalili
Copy link
Contributor

talgalili commented Feb 10, 2023 via email

@tomwagstaff-opml
Copy link
Author

Ahh - good question - I added my lines afterwards - but this only worked with Steve's example, didn't try it with the balance package commands

@talgalili talgalili changed the title Seaborn plots not working When using the RStudio IDE to run Python: Seaborn plots not working Feb 11, 2023
@talgalili
Copy link
Contributor

@tomwagstaff-opml thanks for the report!
I've updated this issue to be "When using the RStudio IDE to run Python: Seaborn plots not working".

If you get around to it, could you please try using a jupyter notebook to run the example, and see if it works fine for you there?
Even if not - it's fine - I think you've given us enough input to better understand this.

To be honest - I doubt that we'll prioratize supporting RStudio's IDE in the near future. But if you or someone else would like to try and do a PR, we'd be happy to review it (and if it works, to include it back into balance)

Thanks again Tom!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants