Ticket #11915: trac-11915-matplotlib-1.1.0-upgrade.patch

File trac-11915-matplotlib-1.1.0-upgrade.patch, 7.4 KB (added by Jason Grout, 11 years ago)
  • sage/plot/colors.py

    # HG changeset patch
    # User Jason Grout <jason.grout@drake.edu>
    # Date 1323969902 21600
    # Node ID 8a5e94b542f96305b4bb695aa054f7868de8fd02
    # Parent  3a08bea34a150120a2b2dee6e1b4649723233b48
    Various changes from the matplotlib 1.1.0 update.
    
    * clabel now supports callables as formatters, so update the documentation
    * yet again, the number of colormaps changed, so the doctest has now been updated to not depend on the exact number of colormaps
    * the figure.tight_layout() function provides prettier graphs.  This also necessitated a change in making colorbar axes
    * Updated the marker documentation for lines (and put a reference to the docs, rather than repeating every single possible marker)
    
    diff --git a/sage/plot/colors.py b/sage/plot/colors.py
    a b  
    12381238            sage: len(maps.maps)
    12391239            0
    12401240            sage: maps.load_maps()
    1241             sage: len(maps.maps)
    1242             134
     1241            sage: len(maps.maps)>130
     1242            True
    12431243        """
    12441244        global cm
    12451245        if not cm:
     
    12821282
    12831283            sage: from sage.plot.colors import Colormaps
    12841284            sage: maps = Colormaps()
    1285             sage: len(maps)
    1286             134
     1285            sage: len(maps)>130
     1286            True
    12871287        """
    12881288        self.load_maps()
    12891289        return len(self.maps)
  • sage/plot/contour_plot.py

    diff --git a/sage/plot/contour_plot.py b/sage/plot/contour_plot.py
    a b  
    194194        if options.get('colorbar', False):
    195195            colorbar_options = options['colorbar_options']
    196196            from matplotlib import colorbar
    197             cax,kwds=colorbar.make_axes(subplot,**colorbar_options)
     197            cax,kwds=colorbar.make_axes_gridspec(subplot,**colorbar_options)
    198198            if CSF is None:
    199199                cb=colorbar.Colorbar(cax,CS, **kwds)
    200200            else:
     
    278278      - ``label_fmt`` -- a format string (default: "%1.2f"), this is
    279279        used to get the label text from the level.  This can also be a
    280280        dictionary with the contour levels as keys and corresponding
    281         text string labels as values.
     281        text string labels as values.  It can also be any callable which
     282        returns a string when called with a numeric contour level.
    282283
    283284    - ``colorbar`` -- boolean (default: False) Show a colorbar or not.
    284285   
     
    389390
    390391    ::
    391392
     393        sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), fill=False, cmap='hsv',labels=True,\
     394        ...    contours=[-4,0,4],  label_fmt=lambda x: "$z=%s$"%x, label_colors='black', label_inline=True, \
     395        ...    label_fontsize=12)
     396        sage: P
     397
     398    ::
     399
    392400        sage: P=contour_plot(y^2 + 1 - x^3 - x, (x,-pi,pi), (y,-pi,pi), \
    393401        ...    fill=False, cmap='hsv', labels=True, label_fontsize=18)
    394402        sage: P
     
    698706
    699707        sage: s,t=var('s,t')
    700708        sage: region_plot(s>0,(t,-2,2),(s,-2,2))
     709
     710    ::
     711
    701712        sage: region_plot(s>0,(s,-2,2),(t,-2,2))
    702713
    703714    """
  • sage/plot/line.py

    diff --git a/sage/plot/line.py b/sage/plot/line.py
    a b  
    6363             ('legend_label', 'The label for this item in the legend.'),
    6464             ('linestyle',
    6565              "The style of the line, which is one of '--' (dashed), '-.' (dash dot), '-' (solid), 'steps', ':' (dotted)."),
    66              ('marker',
    67               "'0' (tickleft), '1' (tickright), '2' (tickup), '3' (tickdown), '' (nothing), ' ' (nothing), '+' (plus), ',' (pixel), '.' (point), '1' (tri_down), '3' (tri_left), '2' (tri_up), '4' (tri_right), '<' (triangle_left), '>' (triangle_right), 'None' (nothing), 'D' (diamond), 'H' (hexagon2), '_' (hline), '^' (triangle_up), 'd' (thin_diamond), 'h' (hexagon1), 'o' (circle), 'p' (pentagon), 's' (square), 'v' (triangle_down), 'x' (x), '|' (vline)"),
     66             ('marker', 'the marker symbol (see documentation for line2d for details)'),
    6867             ('markeredgecolor', 'the color of the marker edge'),
    6968             ('markeredgewidth', 'the size of the marker edge in points'),
    7069             ('markerfacecolor', 'the color of the marker face'),
     
    7978                'rgbcolor':'The color as an RGB tuple.',
    8079                'hue':'The color given as a hue.',
    8180                'linestyle':"The style of the line, which is one of '--' (dashed), '-.' (dash dot), '-' (solid), 'steps', ':' (dotted).",
    82                 'marker':"'0' (tickleft), '1' (tickright), '2' (tickup), '3' (tickdown), '' (nothing), ' ' (nothing), '+' (plus), ',' (pixel), '.' (point), '1' (tri_down), '3' (tri_left), '2' (tri_up), '4' (tri_right), '<' (triangle_left), '>' (triangle_right), 'None' (nothing), 'D' (diamond), 'H' (hexagon2), '_' (hline), '^' (triangle_up), 'd' (thin_diamond), 'h' (hexagon1), 'o' (circle), 'p' (pentagon), 's' (square), 'v' (triangle_down), 'x' (x), '|' (vline)",
     81                'marker':"the marker symbol (see documentation for line2d for details)",
    8382                'markersize':'the size of the marker in points',
    8483                'markeredgecolor':'the color of the marker edge',
    8584                'markeredgewidth':'the size of the marker edge in points',
  • sage/plot/matrix_plot.py

    diff --git a/sage/plot/matrix_plot.py b/sage/plot/matrix_plot.py
    a b  
    216216            if options.get('colorbar', False):
    217217                colorbar_options = options['colorbar_options']
    218218                from matplotlib import colorbar
    219                 cax,kwds=colorbar.make_axes(subplot,**colorbar_options)
     219                cax,kwds=colorbar.make_axes_gridspec(subplot,**colorbar_options)
    220220                cb=colorbar.Colorbar(cax,image, **kwds)
    221221
    222222        if origin=='upper':
  • sage/plot/plot.py

    diff --git a/sage/plot/plot.py b/sage/plot/plot.py
    a b  
    24912491            figure.set_canvas(FigureCanvasAgg(figure))
    24922492            # this messes up the aspect ratio!
    24932493            #figure.canvas.mpl_connect('draw_event', pad_for_tick_labels)
     2494           
     2495            # tight_layout adjusts the *subplot* parameters so ticks aren't cut off, etc.
     2496            figure.tight_layout()
     2497
    24942498            if fig_tight is True:
    24952499                figure.savefig(filename, dpi=dpi, bbox_inches='tight',
    24962500                    bbox_extra_artists=self.__bbox_extra_artists,
  • sage/plot/scatter_plot.py

    diff --git a/sage/plot/scatter_plot.py b/sage/plot/scatter_plot.py
    a b  
    150150
    151151    - ``markersize`` -- default: 50
    152152
    153     - ``marker`` -- default: ``'o'``
     153    - ``marker``  - The style of the markers (default ``"o"``), which is one of
     154       - ``"None"`` or ``" "`` or ``""`` (nothing)
     155       - ``","`` (pixel), ``"."`` (point)
     156       - ``"_"`` (horizontal line), ``"|"`` (vertical line)
     157       - ``"o"`` (circle), ``"p"`` (pentagon), ``"s"`` (square), ``"x"`` (x), ``"+"`` (plus), ``"*"`` (star)
     158       - ``"D"`` (diamond), ``"d"`` (thin diamond)
     159       - ``"H"`` (hexagon), ``"h"`` (alternative hexagon)
     160       - ``"<"`` (triangle left), ``">"`` (triangle right), ``"^"`` (triangle up), ``"v"`` (triangle down)
     161       - ``"1"`` (tri down), ``"2"`` (tri up), ``"3"`` (tri left), ``"4"`` (tri right)
     162       - ``0`` (tick left), ``1`` (tick right), ``2`` (tick up), ``3`` (tick down)
     163       - ``4`` (caret left), ``5`` (caret right), ``6`` (caret up), ``7`` (caret down)
     164       - ``"$...$"`` (math TeX string)
    154165
    155166    - ``facecolor`` -- default: ``'#fec7b8'``
    156167