[SciPy-Dev] 2D histogram: request for plotting variable bin size

Ralf Gommers ralf.gommers at gmail.com
Wed Mar 27 15:24:58 EDT 2013


On Wed, Mar 27, 2013 at 11:14 AM, Frank Breitling <fbreitling at aip.de> wrote:

>  Thanks Ralf,
>
> So is there no simple way to test changes before the commit?
>

Sure there is. One way is:
1. build numpy in-place (python setup.py build_ext -i) and add it to your
PYTHONPATH. (alternatively: python setup.py develop)
2. edit the docstring
3. "make html in the doc/ directory
4. the built docs are now in doc/build/html, view the result in your browser

(5. if the result looks good, commit it and send a PR)

Cheers,
Ralf



>
> Frank
>
>
> On 26.03.2013 19:33, Ralf Gommers wrote:
>
>
> On Tue, Mar 26, 2013 at 11:15 AM, Frank Breitling <fbreitling at aip.de>wrote:
>
>> Hi,
>>
>> And how can I add or update images of the numpy doc (e.g. at
>> http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html
>> )?
>>
>
>  That's created by the example code in the histogram2d docstring. So you
> can add an example in that docstring in your own numpy git repo, then send
> a PR with that change on Github.
>
> Ralf
>
>
>
>> Meanwhile I have created an example for histograms with variable bin
>> size at
>> http://www.scipy.org/Cookbook/Histograms
>> and would like to add this to the numpy doc, too. Therefore I need to
>> replace the image.
>>
>> Frank
>>
>>
>> On 02.02.2013 21:52, Sturla Molden wrote:
>> > That is not how it works.
>> >
>> > If you have a suggestion for changing the NumPy (including docs) you
>> > fork NumPy on GitHub.com and post a pull-request with your changes. And
>> > that would be after asking on the NumPy list (not on scipy-dev!).
>> > They might also want you to open an issue on their GitHub tracker.
>> >
>> > All users on scipy.org should be able to update the cookbook. At least
>> > that it how it worked before. If you want to create a new page on the
>> > wiki you just navigate to it with your browser.
>> >
>> > Sturla
>> >
>> >
>> > On 02.02.2013 20:59, Frank Breitling wrote:
>> >> Hi,
>> >>
>> >> So I registered an account, but I have to request write permission by
>> >> email to scipy-dev at scipy.org first.
>> >> So could somebody give me write permission to the page
>> >>
>> http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html
>> >> and maybe also to http://www.scipy.org/Cookbook/Matplotlib ?
>> >>
>> >> Or otherwise could somebody add the example below for me?
>> >>
>> >> Frank
>> >>
>> >> ---
>> >> import numpy as np, matplotlib.pyplot as plt
>> >>
>> >> x = np.random.normal(3, 2, 1000)
>> >> y = np.random.normal(3, 1, 1000)
>> >>
>> >> yedges=xedges=[0,2,3,4,6]
>> >>
>> >> H, yedges, xedges = np.histogram2d(y,x, bins=(yedges,xedges))
>> >> extent = [xedges[0], xedges[-1], yedges[-1], yedges[0]]
>> >>
>> >> #If bin size is equal imshow can be used. It is fast and provides
>> >> interpolation.
>> >> #plt.imshow(H, extent=extent, interpolation='None',
>> >> aspect='auto')
>> >>
>> >> #To display variable bin size pcolar can be used
>> >> X,Y = np.meshgrid(xedges, yedges)
>> >> plt.pcolor(X, Y,
>> >> H)
>> >>
>> >> #If interpolation is needed in addition matplotlib provides the
>> >> NonUniformImage:
>> >> #http://matplotlib.org/examples/pylab_examples/image_nonuniform.html
>> >>
>> >> plt.colorbar()
>> >> plt.show()
>> >>
>> >>
>> >>
>> >> On 2013-02-02 16:44, Sturla Molden wrote:
>> >>> On 02.02.2013 10:53, Frank Breitling wrote:
>> >>>> Hi,
>> >>>>
>> >>>>     From the matplotlib developers it was pointed out, that there is
>> a
>> >>>> NonUniformImage which might be suite for representing interpolated
>> >>>> variable bin size 2D histograms
>> >>>> (
>> https://github.com/matplotlib/matplotlib/issues/1729#issuecomment-13014723
>> ).
>> >>>> There even exists an example
>> >>>> (http://matplotlib.org/examples/pylab_examples/image_nonuniform.html
>> )
>> >>>> but it is very isolated and therefore not well known.
>> >>>> It would be very useful to explain its usage or at least link to it
>> in
>> >>>> the histogram2d example at
>> >>>>
>> http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html
>> .
>> >>>>
>> >>>> In addition a pcolor example (attached below) shouldn't be missing.
>> Even
>> >>>> though it is slow and can't do interpolation, it can at least do a
>> >>>> correct representation for academic purposes.
>> >>>>
>> >>>> Can anybody do that or would you like me to do that myself?
>> >>>>
>> >>>> Frank
>> >>> Since it is at the top of your head, why don't you do it?
>> >>>
>> >>> But it might be better for the SciPy Cookbook's matplotlib section
>> >>> than the NumPy docs. I'm not sure if they want matplotlib examples in
>> >>> the NumPy documentation (ask on the NumPy list before you waste your
>> >>> time on it).
>> >>>
>> >>>
>> >>> http://www.scipy.org/Cookbook/Matplotlib
>> >>>
>> >>>
>> >>>
>> >>> Sturla
>> >>>
>> >>>
>> >>> _______________________________________________
>> >>> SciPy-Dev mailing list
>> >>> SciPy-Dev at scipy.org
>> >>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>> >>>
>> >> _______________________________________________
>> >> SciPy-Dev mailing list
>> >> SciPy-Dev at scipy.org
>> >> http://mail.scipy.org/mailman/listinfo/scipy-dev
>> >>
>> > _______________________________________________
>> > SciPy-Dev mailing list
>> > SciPy-Dev at scipy.org
>> > http://mail.scipy.org/mailman/listinfo/scipy-dev
>> >
>>
>> _______________________________________________
>> SciPy-Dev mailing list
>> SciPy-Dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-dev
>>
>
>
>
> _______________________________________________
> SciPy-Dev mailing listSciPy-Dev at scipy.orghttp://mail.scipy.org/mailman/listinfo/scipy-dev
>
>
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20130327/1a087d97/attachment.html>


More information about the SciPy-Dev mailing list