diff --git a/doc/api/api_changes/2017-05-28-AL_graphicscontext_linestyle.rst b/doc/api/api_changes/2017-05-28-AL_graphicscontext_linestyle.rst new file mode 100644 index 000000000000..2091a8152d19 --- /dev/null +++ b/doc/api/api_changes/2017-05-28-AL_graphicscontext_linestyle.rst @@ -0,0 +1,6 @@ +Deprecation of `GraphicsContextBase`\'s ``linestyle`` property. +``````````````````````````````````````````````````````````````` + +The ``GraphicsContextBase.get_linestyle`` and +``GraphicsContextBase.set_linestyle`` methods, which effectively had no effect, +have been deprecated. diff --git a/doc/api/api_changes/code_removal.rst b/doc/api/api_changes/code_removal.rst index 991240cac0e1..50300b6e62cf 100644 --- a/doc/api/api_changes/code_removal.rst +++ b/doc/api/api_changes/code_removal.rst @@ -22,6 +22,12 @@ removed. The ``ArtistInspector.findobj`` method, which was never working due to the lack of a ``get_children`` method, has been removed. +The deprecated ``point_in_path``, ``get_path_extents``, +``point_in_path_collection``, ``path_intersects_path``, +``convert_path_to_polygons``, ``cleanup_path`` and ``clip_path_to_rect`` +functions in the ``matplotlib.path`` module have been removed. Their +functionality remains exposed as methods on the ``Path`` class. + `Axes.set_aspect("normal")` --------------------------- diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 3438210023f1..9684a79a535f 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -51,7 +51,6 @@ import matplotlib.colors as colors import matplotlib.transforms as transforms import matplotlib.widgets as widgets -#import matplotlib.path as path from matplotlib import rcParams from matplotlib import is_interactive from matplotlib import get_backend @@ -300,8 +299,8 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms, path_ids.append((path, transforms.Affine2D(transform))) for xo, yo, path_id, gc0, rgbFace in self._iter_collection( - gc, master_transform, all_transforms, path_ids, offsets, - offsetTrans, facecolors, edgecolors, linewidths, linestyles, + gc, master_transform, all_transforms, path_ids, offsets, + offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls, offset_position): path, transform = path_id transform = transforms.Affine2D( @@ -907,6 +906,7 @@ def get_joinstyle(self): """ return self._joinstyle + @cbook.deprecated("2.1") def get_linestyle(self): """ Return the linestyle: one of ('solid', 'dashed', 'dashdot', @@ -1057,6 +1057,7 @@ def set_linewidth(self, w): """ self._linewidth = float(w) + @cbook.deprecated("2.1") def set_linestyle(self, style): """ Set the linestyle to be one of ('solid', 'dashed', 'dashdot', diff --git a/lib/matplotlib/backends/backend_pdf.py b/lib/matplotlib/backends/backend_pdf.py index e14aadcb48bd..ed3fa326a2c6 100644 --- a/lib/matplotlib/backends/backend_pdf.py +++ b/lib/matplotlib/backends/backend_pdf.py @@ -2352,8 +2352,6 @@ def clip_cmd(self, cliprect, clippath): (('_hatch', '_hatch_color'), hatch_cmd), ) - # TODO: _linestyle - def delta(self, other): """ Copy properties of other into self and return PDF commands diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index bd9c281e715f..7231de07d1a2 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -28,6 +28,7 @@ import numpy as np import matplotlib +from matplotlib import cbook from matplotlib.backend_bases import (RendererBase, GraphicsContextBase, FigureCanvasBase, FigureManagerBase, NavigationToolbar2, cursors, TimerBase) @@ -408,8 +409,6 @@ class GraphicsContextWx(GraphicsContextBase): 'miter': wx.JOIN_MITER, 'round': wx.JOIN_ROUND} - _dashd_wx = wxc.dashd_wx - _cache = weakref.WeakKeyDictionary() def __init__(self, bitmap, renderer): @@ -509,6 +508,7 @@ def set_joinstyle(self, js): self.gfx_ctx.SetPen(self._pen) self.unselect() + @cbook.deprecated("2.1") def set_linestyle(self, ls): """ Set the line style to be one of @@ -517,7 +517,7 @@ def set_linestyle(self, ls): self.select() GraphicsContextBase.set_linestyle(self, ls) try: - self._style = GraphicsContextWx._dashd_wx[ls] + self._style = wxc.dashd_wx[ls] except KeyError: self._style = wx.LONG_DASH # Style not used elsewhere... diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index e12bcd879c7a..33359350bf00 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -771,11 +771,9 @@ def draw(self, renderer): renderer = PathEffectRenderer(self.get_path_effects(), renderer) renderer.open_group('line2d', self.get_gid()) - funcname = self._lineStyles.get(self._linestyle, '_draw_nothing') - if funcname != '_draw_nothing': + if self._lineStyles[self._linestyle] != '_draw_nothing': tpath, affine = transf_path.get_transformed_path_and_affine() if len(tpath.vertices): - line_func = getattr(self, funcname) gc = renderer.new_gc() self._set_gc_clip(gc) @@ -798,7 +796,8 @@ def draw(self, renderer): if self.get_sketch_params() is not None: gc.set_sketch_params(*self.get_sketch_params()) - line_func(renderer, gc, tpath, affine.frozen()) + gc.set_dashes(self._dashOffset, self._dashSeq) + renderer.draw_path(gc, tpath, affine.frozen()) gc.restore() if self._marker and self._markersize > 0: @@ -1244,26 +1243,6 @@ def set_dashes(self, seq): else: self.set_linestyle((0, seq)) - def _draw_solid(self, renderer, gc, path, trans): - gc.set_linestyle('solid') - gc.set_dashes(self._dashOffset, self._dashSeq) - renderer.draw_path(gc, path, trans) - - def _draw_dashed(self, renderer, gc, path, trans): - gc.set_linestyle('dashed') - gc.set_dashes(self._dashOffset, self._dashSeq) - renderer.draw_path(gc, path, trans) - - def _draw_dash_dot(self, renderer, gc, path, trans): - gc.set_linestyle('dashdot') - gc.set_dashes(self._dashOffset, self._dashSeq) - renderer.draw_path(gc, path, trans) - - def _draw_dotted(self, renderer, gc, path, trans): - gc.set_linestyle('dotted') - gc.set_dashes(self._dashOffset, self._dashSeq) - renderer.draw_path(gc, path, trans) - def update_from(self, other): """copy properties from other to self""" Artist.update_from(self, other) diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index e2746eef6d08..00b97e88b7f0 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -1025,26 +1025,3 @@ def get_paths_extents(paths, transforms=[]): raise ValueError("No paths provided") return Bbox.from_extents(*_path.get_path_collection_extents( Affine2D(), paths, transforms, [], Affine2D())) - - -def _define_deprecated_functions(ns): - from .cbook import deprecated - - # The C++ functions are not meant to be used directly. - # Users should use the more pythonic wrappers in the Path - # class instead. - for func, alternative in [ - ('point_in_path', 'path.Path.contains_point'), - ('get_path_extents', 'path.Path.get_extents'), - ('point_in_path_collection', 'collection.Collection.contains'), - ('path_in_path', 'path.Path.contains_path'), - ('path_intersects_path', 'path.Path.intersects_path'), - ('convert_path_to_polygons', 'path.Path.to_polygons'), - ('cleanup_path', 'path.Path.cleaned'), - ('points_in_path', 'path.Path.contains_points'), - ('clip_path_to_rect', 'path.Path.clip_to_bbox')]: - ns[func] = deprecated( - since='1.3', alternative=alternative)(getattr(_path, func)) - - -_define_deprecated_functions(locals()) diff --git a/lib/matplotlib/patheffects.py b/lib/matplotlib/patheffects.py index 30222e66cd93..d279c650c575 100644 --- a/lib/matplotlib/patheffects.py +++ b/lib/matplotlib/patheffects.py @@ -355,7 +355,6 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace): gc0.set_foreground(shadow_rgbFace) gc0.set_alpha(self._alpha) - gc0.set_linestyle("solid") gc0 = self._update_gc(gc0, self._gc) renderer.draw_path(gc0, tpath, affine0, fill_color) diff --git a/lib/mpl_toolkits/axisartist/axis_artist.py b/lib/mpl_toolkits/axisartist/axis_artist.py index 1f2754ff12ed..7c88fc07c3ba 100644 --- a/lib/mpl_toolkits/axisartist/axis_artist.py +++ b/lib/mpl_toolkits/axisartist/axis_artist.py @@ -156,12 +156,12 @@ def draw(self, renderer): join = self._solidjoinstyle gc.set_joinstyle(join) gc.set_capstyle(cap) + gc.set_dashes(self._dashOffset, self._dashSeq) - funcname = self._lineStyles.get(self._linestyle, '_draw_nothing') - if funcname != '_draw_nothing': - tpath, affine = self._transformed_path.get_transformed_path_and_affine() - lineFunc = getattr(self, funcname) - lineFunc(renderer, gc, tpath, affine.frozen()) + if self._lineStyles[self._linestyle] != '_draw_nothing': + tpath, affine = ( + self._transformed_path.get_transformed_path_and_affine()) + renderer.draw_path(gc, tpath, affine.frozen()) gc.restore() renderer.close_group('line2d') pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy