[Python-modules-commits] [matplotlib] 01/13: Import matplotlib_1.5.1.orig.tar.gz

Sandro Tosi morph at moszumanska.debian.org
Sun Feb 7 22:04:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

morph pushed a commit to branch master
in repository matplotlib.

commit 0ef98e60d02b0531d7a73a18c4af0ef0adf2a3ce
Author: Sandro Tosi <morph at debian.org>
Date:   Sun Feb 7 16:44:42 2016 +0000

    Import matplotlib_1.5.1.orig.tar.gz
---
 INSTALL                                            |  19 ++-
 doc/_static/mpl.css                                |  32 ++++
 doc/_templates/badgesidebar.html                   |  11 ++
 doc/_templates/donate_sidebar.html                 |   5 +
 doc/_templates/index.html                          |  10 +-
 doc/_templates/layout.html                         | 168 ++++++++++++++++++---
 doc/conf.py                                        |   9 +-
 doc/faq/usage_faq.rst                              |  32 +++-
 examples/misc/svg_filter_line.py                   |   2 +-
 examples/misc/svg_filter_pie.py                    |   2 +-
 examples/user_interfaces/embedding_in_tk_canvas.py |   6 +-
 examples/user_interfaces/svg_histogram.py          |   2 +-
 examples/user_interfaces/svg_tooltip.py            |   2 +-
 lib/matplotlib/_version.py                         |   4 +-
 lib/matplotlib/artist.py                           |   2 +-
 lib/matplotlib/tests/test_image.py                 |  56 ++++++-
 src/_backend_agg.cpp                               |   8 +-
 tests.py                                           |   1 +
 18 files changed, 318 insertions(+), 53 deletions(-)

diff --git a/INSTALL b/INSTALL
index 6ea8d7a..07c75fb 100644
--- a/INSTALL
+++ b/INSTALL
@@ -190,28 +190,31 @@ Required Dependencies
 :term:`numpy` |minimum_numpy_version| (or later)
     array support for python (`download numpy <http://numpy.org>`_)
 
+`setuptools <http://pythonhosted.org/setuptools/>`__
+    Setuptools provides extensions for python package installation.
+
 :term:`dateutil` 1.1 or later
     Provides extensions to python datetime handling.  If using pip,
     easy_install or installing from source, the installer will attempt
     to download and install `python_dateutil` from PyPI.
 
-`pyparsing`
+`pyparsing <https://pyparsing.wikispaces.com/>`__
     Required for matplotlib's mathtext math rendering support.  If
     using pip, easy_install or installing from source, the installer
     will attempt to download and install `pyparsing` from PyPI.
 
-libpng 1.2 (or later)
+`libpng 1.2 (or later) <http://www.libpng.org>`__
     library for loading and saving :term:`PNG` files (`download
     <http://www.libpng.org/pub/png/libpng.html>`__). libpng requires
     zlib.
 
-`pytz`
-    Used to manipulate time-zone aware datetimes.
+`pytz <http://pytz.sourceforge.net/>`__
+    Used to manipulate time-zone aware datetimes. http://pypi.python.org/pypi/pytz
 
 :term:`freetype` 2.3 or later
     library for reading true type font files.
 
-``cycler`` 0.9 or later
+`cycler <http://matplotlib.org/cycler/>`__ 0.9 or later
    Composable cycle class used for constructing style-cycles
 
 
@@ -239,11 +242,11 @@ backends and the capabilities they provide.
 
 Optional external programs
 ^^^^^^^^^^^^^^^^^^^^^^^^^^
-ffmpeg/avconv or mencoder
+`ffmpeg <https://www.ffmpeg.org/>`__/`avconv <https://libav.org/avconv.html>`__ or `mencoder <http://www.mplayerhq.hu/design7/news.html>`__
     Required for the animation module to be save out put to movie
     formats.
 
-ImageMagick
+`ImageMagick <http://www.imagemagick.org/>`__
     Required for the animation module to be able to save to animated gif.
 
 Optional dependencies
@@ -253,7 +256,7 @@ Optional dependencies
     If Pillow is installed, matplotlib can read and write a larger
     selection of image file formats.
 
-pkg-config
+`pkg-config <http://www.freedesktop.org/wiki/Software/pkg-config/>`__
     A tool used to find required non-python libraries.  This is not strictly
     required, but can make installation go more smoothly if the libraries and
     headers are not in the expected locations.
diff --git a/doc/_static/mpl.css b/doc/_static/mpl.css
index 545997d..66cd21f 100644
--- a/doc/_static/mpl.css
+++ b/doc/_static/mpl.css
@@ -223,6 +223,9 @@ div.sphinxsidebar {
     text-align: left;
 /*    margin-left: -100%; */
 }
+div.sphinxsidebarwrapper {
+    padding-top: 28px
+}
 
 div.sphinxsidebar h4, div.sphinxsidebar h3 {
     margin: 1em 0 0.5em 0;
@@ -650,3 +653,32 @@ figcaption {
 }
 
 
+.donate_button {
+    background:#11557C;
+    font-weight:normal;
+    border:solid 1px #fff;
+    outline: solid 1px #11557C;
+    clear: both;
+    display: block;
+    width:200px;
+    line-height:2.8;
+    font-size: 16px;
+    text-align: center;
+    cursor:pointer;
+    color:#fff;
+    text-decoration: none;
+    margin: 30px auto 0;
+    z-index:1;
+    transition: background .25s ease;
+}
+
+.donate_button:last-of-type {
+    margin: 15px auto 30px;
+
+
+}
+
+.donate_button:hover, .donate_button:active, .donate_button:focus {
+    background: #003c63;
+    outline-color: #003c63;
+}
diff --git a/doc/_templates/badgesidebar.html b/doc/_templates/badgesidebar.html
new file mode 100644
index 0000000..7db65ed
--- /dev/null
+++ b/doc/_templates/badgesidebar.html
@@ -0,0 +1,11 @@
+
+<a href="http://depsy.org/package/python/matplotlib">
+  <img src="http://depsy.org/api/package/pypi/matplotlib/badge.svg">
+</a>
+
+<br/>
+
+Travis-CI: <a href="https://travis-ci.org/matplotlib/matplotlib">
+  <img src="https://travis-ci.org/matplotlib/matplotlib.svg?branch=master"/>
+</a>
+<br/>
diff --git a/doc/_templates/donate_sidebar.html b/doc/_templates/donate_sidebar.html
new file mode 100644
index 0000000..4cc2bf1
--- /dev/null
+++ b/doc/_templates/donate_sidebar.html
@@ -0,0 +1,5 @@
+
+<div>
+<div onclick="open_window('MjI1OA==')" class="donate_button">Support matplotlib</div>
+<div onclick="open_window('MjM2OA==')" class="donate_button">Support NumFOCUS</div>
+</div>
diff --git a/doc/_templates/index.html b/doc/_templates/index.html
index 3fb1239..4d235eb 100644
--- a/doc/_templates/index.html
+++ b/doc/_templates/index.html
@@ -181,8 +181,7 @@ axes and axis helpers in <a href="{{ pathto('mpl_toolkits/axes_grid/index') }}">
 Please
 consider <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X9T4KLZT2794S">donating
 to the matplotlib project</a> through the Numfocus organization or to
-the <a href="http://numfocus.org/johnhunter/">John Hunter Memorial
-Fund</a>.
+the <a href="http://numfocus.org/johnhunter/">John Hunter Technology Fellowship</a>.
 </p>
 
 <p>
@@ -195,6 +194,13 @@ There is an active developer community and a long list of people
 who have made significant <a href="{{ pathto('users/credits') }}">contributions</a>.
 </p>
 
+<p>
+Matplotlib is hosted on <a href="https://github.com/matplotlib/matplotlib">Github</a>.
+<a href="https://github.com/matplotlib/matplotlib/issues">Issues</a> and
+<a href="https://github.com/matplotlib/matplotlib/pulls">Pull requests</a>
+are tracked at Github too.
+</p>
+
 
 <div class="footnote"><p>
 <sup><a name="ftn.matlab" href="#matlab">*</a></sup>
diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html
index cb193d0..0a72bb0 100644
--- a/doc/_templates/layout.html
+++ b/doc/_templates/layout.html
@@ -69,23 +69,6 @@ alt="Logo"/>
             {%- for sidebartemplate in sidebars %}
             {%- include sidebartemplate %}
             {%- endfor %}
-          {%- else %}
-            {#- old style sidebars: using blocks -- should be deprecated #}
-            {%- block sidebartoc %}
-            {%- include "localtoc.html" %}
-            {%- endblock %}
-            {%- block sidebarrel %}
-            {%- include "relations.html" %}
-            {%- endblock %}
-            {%- block sidebarsourcelink %}
-            {%- include "sourcelink.html" %}
-            {%- endblock %}
-            {%- if customsidebar %}
-            {%- include customsidebar %}
-            {%- endif %}
-            {%- block sidebarsearch %}
-            {%- include "searchbox.html" %}
-            {%- endblock %}
           {%- endif %}
         </div>
       </div>
@@ -170,7 +153,7 @@ parents[-1].link|e }}" />
     {%- endif %}
 {%- endblock %}
 {%- block extrahead %} {% endblock %}
-<link href="http://fonts.googleapis.com/css?family=Raleway" rel="stylesheet" type="text/css">
+
 
   </head>
   <body>
@@ -266,4 +249,153 @@ href="http://sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
 
 </script>
 </body>
+<footer>
+  <!--Flipcause Integration v3.0// Flipcause Integration Instructions:
+Install the following code block once in the website Header (after <head> tag) -->
+
+<style>
+
+.fc-black_overlay{
+display:none; position: fixed; z-index:1000001; top: 0%;left: 0%;width: 100%;height: 100%;
+background-color: black; filter: alpha(opacity=50); cursor:pointer; opacity:0.5;
+}
+
+.fc-white_content {
+opacity:1; display:none; margin-top: -320px; margin-left: -485px; width:970px; height:640px;
+position:fixed; top:50%; left:50%; border: none;z-index:1000002;overflow: auto;
+}
+
+.fc-main-box{
+opacity:1; display:none; margin:15px auto 0 auto; width:930px; position:relative; z-index:1000003;
+}
+
+.fc-widget_close{
+opacity:1; content:url(http://i1338.photobucket.com/albums/o691/WeCause/X_zpse4a7e538.png);
+position:absolute; z-index=1000004; right:-16px; top:-16px; display:block; cursor:pointer;
+}
+
+.floating_button{
+display: block; margin-top: 0px; margin-left: 0px; width:auto ; height: auto;
+position:fixed; z-index:999999; overflow: auto;
+}
+
+ at keyframes backfadesin {
+   from { opacity:0; }
+   to {opacity:.5;}
+}
+
+ at -moz-keyframes backfadesin {
+    from { opacity:0; }
+    to {opacity:.5;}
+}
+
+ at -webkit-keyframes backfadesin {
+    from { opacity:0; }
+    to {opacity:.5;}
+}
+
+ at -o-keyframes backfadesin {
+    from { opacity:0; }
+    to {opacity:.5;}
+}
+
+
+ at -ms-keyframes backfadesin {
+    from { opacity:0; }
+    to {opacity:.5;}
+}
+
+ at keyframes fadesin {
+   0%{ opacity:0; }
+   50%{ opacity:0; }
+   75% {opacity: 0; transform: translateY(20px);}
+   100% {opacity: 1; transform: translateY(0);}
+}
+
+ at -moz-keyframes fadesin {
+   0%{ opacity:0; }
+   50%{ opacity:0; }
+   75% {opacity: 0; -moz-transform: translateY(20px);}
+   100% {opacity: 1; -moz-transform: translateY(0);}
+}
+
+ at -webkit-keyframes fadesin {
+   0%{ opacity:0; }
+   50%{ opacity:0; }
+   75% {opacity: 0; -webkit-transform: translateY(20px);}
+   100% {opacity: 1; -webkit-transform: translateY(0);}
+}
+
+ at -o-keyframes fadesin {
+   0%{ opacity:0; }
+   50%{ opacity:0; }
+   75% {opacity: 0; -o-transform: translateY(20px);}
+   100% {opacity: 1; -o-transform: translateY(0);}
+}
+
+ at -ms-keyframes fadesin {
+   0%{ opacity:0; }
+   50%{ opacity:0; }
+   75% {opacity: 0; -ms-transform: translateY(20px);}
+   100% {opacity: 1; -ms-transform: translateY(0);}
+}
+
+</style>
+
+<script>
+
+function open_window(cause_id) {
+var  protocol=String(document.location.protocol);
+var new_url;
+if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
+new_url="https://www.flipcause.com/widget/"+cause_id
+window.open(new_url);
+}
+
+else {
+document.getElementById("fc-fade").style.display = "block";
+document.getElementById("fc-fade").style.webkitAnimation = "backfadesin 1s";
+document.getElementById("fc-fade").style.animation = "backfadesin 1s";
+document.getElementById("fc-fade").style.mozAnimation = "backfadesin 1s";
+document.getElementById("fc-light").style.display = "block";
+document.getElementById("fc-light").style.webkitAnimation = "fadesin 1.5s";
+document.getElementById("fc-light").style.animation = "fadesin 1.5s";
+document.getElementById("fc-light").style.mozAnimation = "fadesin 1.5s";
+document.getElementById("fc-main").style.display = "block";
+document.getElementById("fc-main").style.webkitAnimation = "fadesin 1.5s";
+document.getElementById("fc-main").style.animation = "fadesin 1.5s";
+document.getElementById("fc-main").style.mozAnimation = "fadesin 1.5s";
+document.getElementById("fc-close").style.display = "block";
+document.getElementById("fc-close").style.webkitAnimation = "fadesin 1.5s";
+document.getElementById("fc-close").style.animation = "fadesin 1.5s";
+document.getElementById("fc-close").style.mozAnimation = "fadesin 1.5s";
+document.getElementById("fc-myFrame").style.display = "block";
+document.getElementById("fc-myFrame").style.webkitAnimation = "fadesin 1.5s";
+document.getElementById("fc-myFrame").style.animation = "fadesin 1.5s";
+document.getElementById("fc-myFrame").style.mozAnimation = "fadesin 1.5s";
+document.getElementById("fc-myFrame").src="https://www.flipcause.com/widget/"+cause_id;
+}
+}
+
+
+function close_window() {
+document.getElementById("fc-fade").style.display="none";
+document.getElementById("fc-light").style.display="none";
+document.getElementById("fc-main").style.display="none";
+document.getElementById("fc-close").style.display="none";
+document.getElementById("fc-myFrame").style.display="none";
+}
+
+</script>
+
+<div id="fc-fade" class="fc-black_overlay" onclick="close_window()"></div>
+<div id="fc-light" class="fc-white_content">
+<div id="fc-main" class="fc-main-box">
+<div id="fc-close" class="fc-widget_close" onclick="close_window()">
+</div><iframe id="fc-myFrame" iframe height="580" width="925" style="border: 0;
+border-radius:5px 5px 5px 5px; box-shadow:0 0 8px rgba(0, 0, 0, 0.5);" scrolling="no" src=""></iframe></div>
+</div>
+
+<!--END Flipcause Main Integration Code-->
+</footer>
 </html>
diff --git a/doc/conf.py b/doc/conf.py
index 6de3566..ed1f2fd 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -186,9 +186,12 @@ html_index = 'index.html'
 #html_sidebars = {}
 
 # Custom sidebar templates, maps page names to templates.
-html_sidebars = {'index': 'indexsidebar.html',
-                 }
-
+html_sidebars = {
+    'index': ['badgesidebar.html','donate_sidebar.html',
+              'indexsidebar.html', 'searchbox.html'],
+    '**': ['badgesidebar.html', 'localtoc.html',
+           'relations.html', 'sourcelink.html', 'searchbox.html']
+}
 
 # Additional templates that should be rendered to pages, maps page names to
 # template names.
diff --git a/doc/faq/usage_faq.rst b/doc/faq/usage_faq.rst
index f401c49..4c5e7f2 100644
--- a/doc/faq/usage_faq.rst
+++ b/doc/faq/usage_faq.rst
@@ -417,14 +417,16 @@ a file:
 ============   ================================================================
 Backend        Description
 ============   ================================================================
-GTKAgg         Agg rendering to a :term:`GTK` 2.x canvas (requires PyGTK_)
-GTK3Agg        Agg rendering to a :term:`GTK` 3.x canvas (requires PyGObject_)
+GTKAgg         Agg rendering to a :term:`GTK` 2.x canvas (requires PyGTK_ and
+               pycairo_ or cairocffi_; Python2 only)
+GTK3Agg        Agg rendering to a :term:`GTK` 3.x canvas (requires PyGObject_
+               and pycairo_ or cairocffi_)
 GTK            GDK rendering to a :term:`GTK` 2.x canvas (not recommended)
-               (requires PyGTK_)
+               (requires PyGTK_ and pycairo_ or cairocffi_; Python2 only)
 GTKCairo       Cairo rendering to a :term:`GTK` 2.x canvas (requires PyGTK_
-               and pycairo_)
+               and pycairo_ or cairocffi_; Python2 only)
 GTK3Cairo      Cairo rendering to a :term:`GTK` 3.x canvas (requires PyGObject_
-               and pycairo_)
+               and pycairo_ or cairocffi_)
 WXAgg          Agg rendering to to a :term:`wxWidgets` canvas
                (requires wxPython_)
 WX             Native :term:`wxWidgets` drawing to a :term:`wxWidgets` Canvas
@@ -446,11 +448,31 @@ macosx         Cocoa rendering in OSX windows
 .. _PyGTK: http://www.pygtk.org
 .. _PyGObject: https://live.gnome.org/PyGObject
 .. _pycairo: http://www.cairographics.org/pycairo/
+.. _cairocffi: https://pythonhosted.org/cairocffi/
 .. _wxPython: http://www.wxpython.org/
 .. _TkInter: http://wiki.python.org/moin/TkInter
 .. _PyQt4: http://www.riverbankcomputing.co.uk/software/pyqt/intro
 .. _PyQt5: http://www.riverbankcomputing.co.uk/software/pyqt/intro
 
+WX backends
+===========
+
+At present the release version of `wxPython` (also known as wxPython classic)
+does not support python3. A work in progress redesigned version known as
+wxPython-Phoenix_ does support python3.
+Matplotlib should work with both versions.
+
+.. _wxPython-Phoenix: http://wxpython.org/Phoenix/docs/html/main.html
+
+GTK and Cairo
+=============
+
+Both `GTK2` and `GTK3` have implicit dependencies on PyCairo regardless of the
+specific Matplotlib backend used. Unfortunatly the latest release of PyCairo
+for Python3 does not implement the Python wrappers needed for the `GTK3Agg`
+backend. `Cairocffi` can be used as a replacement which implements the correct
+wrapper.
+
 How do I select PyQt4 or PySide?
 ========================================
 
diff --git a/examples/misc/svg_filter_line.py b/examples/misc/svg_filter_line.py
index 8dd6bf6..48a6564 100644
--- a/examples/misc/svg_filter_line.py
+++ b/examples/misc/svg_filter_line.py
@@ -52,7 +52,7 @@ ax.set_xlim(0., 1.)
 ax.set_ylim(0., 1.)
 
 # save the figure as a string in the svg format.
-from StringIO import StringIO
+from io import StringIO
 f = StringIO()
 plt.savefig(f, format="svg")
 
diff --git a/examples/misc/svg_filter_pie.py b/examples/misc/svg_filter_pie.py
index 20aa9e1..64b76be 100644
--- a/examples/misc/svg_filter_pie.py
+++ b/examples/misc/svg_filter_pie.py
@@ -42,7 +42,7 @@ for w in pies[0]:
 
 
 # save
-from StringIO import StringIO
+from io import StringIO
 f = StringIO()
 plt.savefig(f, format="svg")
 
diff --git a/examples/user_interfaces/embedding_in_tk_canvas.py b/examples/user_interfaces/embedding_in_tk_canvas.py
index b34431e..6088042 100755
--- a/examples/user_interfaces/embedding_in_tk_canvas.py
+++ b/examples/user_interfaces/embedding_in_tk_canvas.py
@@ -3,7 +3,11 @@
 
 import matplotlib as mpl
 import numpy as np
-import Tkinter as tk
+import sys
+if sys.version_info[0] < 3:
+    import Tkinter as tk
+else:
+    import tkinter as tk
 import matplotlib.backends.tkagg as tkagg
 from matplotlib.backends.backend_agg import FigureCanvasAgg
 
diff --git a/examples/user_interfaces/svg_histogram.py b/examples/user_interfaces/svg_histogram.py
index f360357..51f5e14 100755
--- a/examples/user_interfaces/svg_histogram.py
+++ b/examples/user_interfaces/svg_histogram.py
@@ -35,7 +35,7 @@ __author__="david.huard at gmail.com"
 import numpy as np
 import matplotlib.pyplot as plt
 import xml.etree.ElementTree as ET
-from StringIO import StringIO
+from io import StringIO
 import json
 
 plt.rcParams['svg.embed_char_paths'] = 'none'
diff --git a/examples/user_interfaces/svg_tooltip.py b/examples/user_interfaces/svg_tooltip.py
index 3917e61..6b647d1 100644
--- a/examples/user_interfaces/svg_tooltip.py
+++ b/examples/user_interfaces/svg_tooltip.py
@@ -24,7 +24,7 @@ the appearance by the CSS.
 
 import matplotlib.pyplot as plt
 import xml.etree.ElementTree as ET
-from StringIO import StringIO
+from io import StringIO
 
 ET.register_namespace("", "http://www.w3.org/2000/svg")
 
diff --git a/lib/matplotlib/_version.py b/lib/matplotlib/_version.py
index 513c951..b02cea4 100644
--- a/lib/matplotlib/_version.py
+++ b/lib/matplotlib/_version.py
@@ -20,8 +20,8 @@ def get_keywords():
     # setup.py/versioneer.py will grep for the variable names, so they must
     # each be defined on a line of their own. _version.py will just call
     # get_keywords().
-    git_refnames = " (tag: v1.5.1rc1, v1.5.x)"
-    git_full = "9d76fd4e92f00d7a314b4d601a540a0e2513dab3"
+    git_refnames = " (tag: v1.5.1)"
+    git_full = "be91fac9fa2b7250080557e723af75124659da4e"
     keywords = {"refnames": git_refnames, "full": git_full}
     return keywords
 
diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py
index 244c0b6..83a238a 100644
--- a/lib/matplotlib/artist.py
+++ b/lib/matplotlib/artist.py
@@ -1094,7 +1094,7 @@ class ArtistInspector(object):
 
         match = self._get_valid_values_regex.search(docstring)
         if match is not None:
-            return match.group(1).replace('\n', ' ')
+            return re.sub("\n *", " ", match.group(1))
         return 'unknown'
 
     def _get_setters_and_targets(self):
diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py
index 6f69822..08654ab 100644
--- a/lib/matplotlib/tests/test_image.py
+++ b/lib/matplotlib/tests/test_image.py
@@ -2,26 +2,32 @@ from __future__ import (absolute_import, division, print_function,
                         unicode_literals)
 
 from matplotlib.externals import six
+import sys
+import io
+import os
 
 import numpy as np
 
-from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup
+from matplotlib.testing.decorators import (image_comparison,
+                                           knownfailureif, cleanup)
 from matplotlib.image import BboxImage, imread, NonUniformImage
 from matplotlib.transforms import Bbox
 from matplotlib import rcParams
 import matplotlib.pyplot as plt
-from nose.tools import assert_raises
-from numpy.testing import assert_array_equal, assert_array_almost_equal
 
-import io
-import os
+from numpy.testing import assert_array_equal
+
+
+import nose
 
 try:
     from PIL import Image
+    del Image
     HAS_PIL = True
 except ImportError:
     HAS_PIL = False
 
+
 @image_comparison(baseline_images=['image_interps'])
 def test_image_interps():
     'make the basic nearest, bilinear and bicubic interps'
@@ -447,12 +453,52 @@ def test_nonuniformimage_setcmap():
     im = NonUniformImage(ax)
     im.set_cmap('Blues')
 
+
 @cleanup
 def test_nonuniformimage_setnorm():
     ax = plt.gca()
     im = NonUniformImage(ax)
     im.set_norm(plt.Normalize())
 
+
+ at cleanup
+def test_minimized_rasterized():
+    # This ensures that the rasterized content in the colorbars is
+    # only as thick as the colorbar, and doesn't extend to other parts
+    # of the image.  See #5814.  While the original bug exists only
+    # in Postscript, the best way to detect it is to generate SVG
+    # and then parse the output to make sure the two colorbar images
+    # are the same size.
+    if sys.version_info[:2] < (2, 7):
+        raise nose.SkipTest("xml.etree.ElementTree.Element.iter "
+                            "added in py 2.7")
+
+    from xml.etree import ElementTree
+
+    np.random.seed(0)
+    data = np.random.rand(10, 10)
+
+    fig, ax = plt.subplots(1, 2)
+    p1 = ax[0].pcolormesh(data)
+    p2 = ax[1].pcolormesh(data)
+
+    plt.colorbar(p1, ax=ax[0])
+    plt.colorbar(p2, ax=ax[1])
+
+    buff = io.BytesIO()
+    plt.savefig(buff, format='svg')
+
+    buff = io.BytesIO(buff.getvalue())
+    tree = ElementTree.parse(buff)
+    width = None
+    for image in tree.iter('image'):
+        if width is None:
+            width = image['width']
+        else:
+            if image['width'] != width:
+                assert False
+
+
 if __name__=='__main__':
     import nose
     nose.runmodule(argv=['-s','--with-doctest'], exit=False)
diff --git a/src/_backend_agg.cpp b/src/_backend_agg.cpp
index 9e9ae5c..e472156 100644
--- a/src/_backend_agg.cpp
+++ b/src/_backend_agg.cpp
@@ -210,10 +210,10 @@ agg::rect_i RendererAgg::get_content_extents()
         }
     }
 
-    r.x1 = std::max(0, r.x1 - 1);
-    r.y1 = std::max(0, r.y1 - 1);
-    r.x2 = std::max(r.x2 + 1, (int)width);
-    r.y2 = std::max(r.y2 + 1, (int)height);
+    r.x1 = std::max(0, r.x1);
+    r.y1 = std::max(0, r.y1);
+    r.x2 = std::min(r.x2 + 1, (int)width);
+    r.y2 = std::min(r.y2 + 1, (int)height);
 
     return r;
 }
diff --git a/tests.py b/tests.py
index ed5f3b4..1eaca1f 100755
--- a/tests.py
+++ b/tests.py
@@ -67,5 +67,6 @@ if __name__ == '__main__':
         from matplotlib.testing import disable_internet
         disable_internet.turn_off_internet()
         extra_args.extend(['--eval-attr="not network"'])
+        sys.argv.remove('--no-network')
 
     run(extra_args)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/matplotlib.git



More information about the Python-modules-commits mailing list