{"action":"created","issue":{"url":"https://api.github.com/repos/astroML/astroML/issues/54","labels_url":"https://api.github.com/repos/astroML/astroML/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/astroML/astroML/issues/54/comments","events_url":"https://api.github.com/repos/astroML/astroML/issues/54/events","html_url":"https://github.com/astroML/astroML/issues/54","id":57468571,"number":54,"title":"Using hist forces plot to appear","user":{"login":"Gabriel-p","id":6054951,"avatar_url":"https://avatars.githubusercontent.com/u/6054951?v=3","gravatar_id":"","url":"https://api.github.com/users/Gabriel-p","html_url":"https://github.com/Gabriel-p","followers_url":"https://api.github.com/users/Gabriel-p/followers","following_url":"https://api.github.com/users/Gabriel-p/following{/other_user}","gists_url":"https://api.github.com/users/Gabriel-p/gists{/gist_id}","starred_url":"https://api.github.com/users/Gabriel-p/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gabriel-p/subscriptions","organizations_url":"https://api.github.com/users/Gabriel-p/orgs","repos_url":"https://api.github.com/users/Gabriel-p/repos","events_url":"https://api.github.com/users/Gabriel-p/events{/privacy}","received_events_url":"https://api.github.com/users/Gabriel-p/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-12T14:43:36Z","updated_at":"2015-02-12T17:21:35Z","closed_at":null,"body":"I'm currently using the `hist` function (`from astroML.plotting import hist`) to obtain bin edges, not to generate a plot.\r\n\r\nWhen a `plt.show()` line appears _much_ further down the code, the histogram generated by `hist` is shown next to whatever I am plotting.\r\n\r\nCan this behaviour be prevented somehow?"},"comment":{"url":"https://api.github.com/repos/astroML/astroML/issues/comments/74112418","html_url":"https://github.com/astroML/astroML/issues/54#issuecomment-74112418","issue_url":"https://api.github.com/repos/astroML/astroML/issues/54","id":74112418,"user":{"login":"jakevdp","id":781659,"avatar_url":"https://avatars.githubusercontent.com/u/781659?v=3","gravatar_id":"","url":"https://api.github.com/users/jakevdp","html_url":"https://github.com/jakevdp","followers_url":"https://api.github.com/users/jakevdp/followers","following_url":"https://api.github.com/users/jakevdp/following{/other_user}","gists_url":"https://api.github.com/users/jakevdp/gists{/gist_id}","starred_url":"https://api.github.com/users/jakevdp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakevdp/subscriptions","organizations_url":"https://api.github.com/users/jakevdp/orgs","repos_url":"https://api.github.com/users/jakevdp/repos","events_url":"https://api.github.com/users/jakevdp/events{/privacy}","received_events_url":"https://api.github.com/users/jakevdp/received_events","type":"User","site_admin":false},"created_at":"2015-02-12T17:21:35Z","updated_at":"2015-02-12T17:21:35Z","body":"Yes, the ``hist()`` function is meant as a plotting function. If you want to compute the histogram without generating a plot, you can use the binning functions directly, e.g.\r\n```\r\nfrom astroML.density_estimation import bayesian_blocks\r\nx = np.random.random(100)\r\nbins = bayesian_blocks(x)\r\n```\r\nIf you take a look at the [source code for ``hist()``](https://github.com/astroML/astroML/blob/master/astroML/plotting/hist_tools.py#L10) you'll see that it's just a thin wrapper around the sequence of computing bins plus plotting."}}