-
Notifications
You must be signed in to change notification settings - Fork 47
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
Use pyfair inside Jupyter notebooks #31
Comments
Thanks for your interest. Tentative yes. I'll take a look this weekend and see if I can cobble together a sustainable solution. |
Thanks a lot, this is working in Jupyter, I will post a notebook example as a starting point:
|
Perfect, thank you. I think this is a common enough use case that I'm leaning towards creating a new class. Haven't thought about all the implications yet, but I think this probably would make usage less painful.
|
I like that yes! |
I would say also add a few parameters such as figsize, legends could be helfpul. |
@priamai ... thanks again for the idea. This is definitely do-able and will be included in the next release. Two questions:
|
Yes sorry ignore my previous suggestion, having the figs and axes will be perfect as I will be able to change title and sizes for example. |
@priamai , at your convenience would you check the newest Docker Hub image and see if the shim works as intended? |
okay testing now! |
@theonaunheim from inside the jupyter environment I tried this: Let me know how should I use the new classes. |
Thanks for your help. I forgot to mention that I changed "get_tree()" to "get_trees()" so all the method names reflected that they took iterables as inputs. The method names are now: |
Hi @theonaunheim tested it again Do I have to install ipympl? |
I also tried:
then I get same error. |
Hmm ... I will try debugging this tomorrow. I am not entirely sure what the problem is, but I should be able to sort it out by Monday and provide feedback. |
Hey, @priamai . Apologies for the delay--last weekend was a total wash. I went ahead and included pip ipympl and the notebook plugin build in the docker image. This means that you can use the 'widget', 'inline', and 'ipympl'. 'notebook' doesn't work for me for reasons I do not fully understand. I suspect that it has something to do with this in the base jupyter-scipy-notebook image: |
Hi @theonaunheim, |
Edit: TL;DR: this is an upstream WONTFIX problem. You can use "%matplotlib notebook" by getting rid of "-e JUPYTER_ENABLE_LAB=yes" from the Docker run command, which will start Jupyter Notebook instead of Jupyter lab. Alternatively, you can get similar functionality in Jupyter Lab using "%matplotlib widget". Also, I've learned that you always want to import pyfair AFTER you've set the backend. Hey, @priamai ... in the process of putting together a bug report I found the problem. Spoiler alert: I was the problem. A couple of intersecting causes:
So, if you want to use "%matplotlib notebook" you will need to remove the "-e JUPYTER_ENABLE_LAB=yes" from the run instructions and you can use "%matplotlib notebook" as usual. Take note to only import pyfair AFTER you set the backend. If you want to use interactive images in Jupyter Lab, you will need to use "%matplotlib widget" (ipympl backend). The "MPLBACKEND=Agg" environment variable was a canard ... we're overriding this at runtime anyway. I think the problem is with "%matplotlib notebook" in Jupyter Lab is we send to a backend that that doesn't have a defined interface. Working examples below:
lab_matplotlib_inline.pdf |
Hi there,
fantastic project but would like to see how one could embed the single chart components inside a jupyter notebook instead of producing the HTML page.
The text was updated successfully, but these errors were encountered: