File: api_changes_0.82.rst

package info (click to toggle)
matplotlib 3.10.1%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 78,352 kB
  • sloc: python: 147,118; cpp: 62,988; objc: 1,679; ansic: 1,426; javascript: 786; makefile: 104; sh: 53
file content (52 lines) | stat: -rw-r--r-- 1,946 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Changes for 0.82
================

.. code-block:: text

  - toolbar import change in GTKAgg, GTKCairo and WXAgg

  - Added subplot config tool to GTK* backends -- note you must now
    import the NavigationToolbar2 from your backend of choice rather
    than from backend_gtk because it needs to know about the backend
    specific canvas -- see examples/embedding_in_gtk2.py.  Ditto for
    wx backend -- see examples/embedding_in_wxagg.py


  - hist bin change

      Sean Richards notes there was a problem in the way we created
      the binning for histogram, which made the last bin
      underrepresented.  From his post:

        I see that hist uses the linspace function to create the bins
        and then uses searchsorted to put the values in their correct
        bin. That's all good but I am confused over the use of linspace
        for the bin creation. I wouldn't have thought that it does
        what is needed, to quote the docstring it creates a "Linear
        spaced array from min to max". For it to work correctly
        shouldn't the values in the bins array be the same bound for
        each bin? (i.e. each value should be the lower bound of a
        bin). To provide the correct bins for hist would it not be
        something like

        def bins(xmin, xmax, N):
          if N==1: return xmax
          dx = (xmax-xmin)/N # instead of N-1
          return xmin + dx*arange(N)


       This suggestion is implemented in 0.81.  My test script with these
       changes does not reveal any bias in the binning

        from matplotlib.numerix.mlab import randn, rand, zeros, Float
        from matplotlib.mlab import hist, mean

        Nbins = 50
        Ntests = 200
        results = zeros((Ntests,Nbins), typecode=Float)
        for i in range(Ntests):
            print 'computing', i
            x = rand(10000)
            n, bins = hist(x, Nbins)
            results[i] = n
        print mean(results)