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

Add hint about plt.show() or similar to get plots to show in terminal #50

Open
JacekHoleczek opened this issue Aug 5, 2023 · 3 comments
Labels

Comments

@JacekHoleczek
Copy link
Contributor

JacekHoleczek commented Aug 5, 2023

It seems I am missing something very basic.

The "Basic file I/O with Uproot" chapter contains: h.to_hist().plot()

The "TTree details" chapter contains (twice): masshist.plot()

It seems you expect that these histograms are "displayed", but I get completely nothing physically drawn on my screen (a local X11 server and a "ssh -X -Y" connection to a remote Linux machine with an "activated" Python 3.11.4 conda-forge environment).

Well, I can get them "displayed", if I afterward execute (but that is not shown in the tutorial):

import matplotlib.pyplot as plt; plt.show()

In the "Histogram manipulations and fitting" chapter, in the "Matplotlib" section, there is (and that is the only place in the tutorial which imports matplotlib):

import matplotlib.pyplot as plt
plt.hist(tree["M"].array())

But this does not physically draw it either (the final "plt.show()" is missing).

@klieret
Copy link
Member

klieret commented Aug 7, 2023

Hi @JacekHoleczek. Thank you for this report. The tutorial might assume that we're in a notebook, probably with %matplotlib inline on top.

If you want to use the command line, you might want to use the ipython REPL rather than the plain python REPL.

See this answer.

@klieret klieret changed the title Scikit-HEP Tutorial -> something.plot() does not show anything Add hint about plt.show() or similar to get plots to show in terminal Aug 7, 2023
@JacekHoleczek
Copy link
Contributor Author

JacekHoleczek commented Aug 7, 2023

In this case, could you please, add a dedicated paragraph (at least somewhere before the first "plot()" command) that says something like this:

In order to enable interactive mode, which shows / updates figures after every plotting command so that calling show() is not necessary, one needs to execute once in a session:
import matplotlib.pyplot as plt; plt.ion()

@stale
Copy link

stale bot commented Oct 6, 2023

This issue or pull request has been automatically marked as stale because it has not had recent activity. Please manually close it, if it is no longer relevant, or ask for help or support to help getting it unstuck. Let me bring this to the attention of @klieret @wdconinc @michmx for now.

@stale stale bot added the stale label Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants