diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index d4d3578b6e51..3c0bb916bb7f 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -90,12 +90,24 @@ def _process_plot_format(fmt): # handle the multi char special cases and strip them from the # string - if fmt.find('--') >= 0: + if fmt.find('--@loose') >= 0: + linestyle = '--@loose' + fmt = fmt.replace('--@loose', '') + elif fmt.find('--') >= 0: linestyle = '--' fmt = fmt.replace('--', '') - if fmt.find('-.') >= 0: + + if fmt.find('-.@loose') >= 0: + linestyle = '-.@loose' + fmt = fmt.replace('-.@loose', '') + elif fmt.find('-.') >= 0: linestyle = '-.' fmt = fmt.replace('-.', '') + + if fmt.find(':@loose') >= 0: + linestyle = ':@loose' + fmt = fmt.replace(':@loose', '') + if fmt.find(' ') >= 0: linestyle = 'None' fmt = fmt.replace(' ', '') diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index 08e7f098d583..3731907a46dc 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -1896,7 +1896,9 @@ def unmasked_index_ranges(mask, compressed=True): # The ls_mapper maps short codes for line style to their full name used by # backends; the reverse mapper is for mapping full names to short ones. -ls_mapper = {'-': 'solid', '--': 'dashed', '-.': 'dashdot', ':': 'dotted'} +ls_mapper = {'-': 'solid', '--': 'dashed', '-.': 'dashdot', ':': 'dotted', + '--@loose': 'dashed@loose', '-.@loose': 'dashdot@loose', + ':@loose': 'dotted@loose'} ls_mapper_r = {v: k for k, v in six.iteritems(ls_mapper)} diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 8ac61ee15963..c3b18e7d90ac 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -43,7 +43,8 @@ def _get_dash_pattern(style): if style in ['solid', 'None']: offset, dashes = None, None # dashed styles - elif style in ['dashed', 'dashdot', 'dotted']: + elif style in ['dashed', 'dashdot', 'dotted', 'dashed@loose', + 'dashdot@loose', 'dotted@loose']: offset = 0 dashes = tuple(rcParams['lines.{}_pattern'.format(style)]) # @@ -239,13 +240,16 @@ class Line2D(Artist): """ lineStyles = _lineStyles = { # hidden names deprecated - '-': '_draw_solid', - '--': '_draw_dashed', - '-.': '_draw_dash_dot', - ':': '_draw_dotted', - 'None': '_draw_nothing', - ' ': '_draw_nothing', - '': '_draw_nothing', + '-': '_draw_solid', + '--': '_draw_dashed', + '-.': '_draw_dash_dot', + ':': '_draw_dotted', + 'None': '_draw_nothing', + ' ': '_draw_nothing', + '': '_draw_nothing', + '--@loose': '_draw_dashed_loose', + '-.@loose': '_draw_dash_dot_loose', + ':@loose': '_draw_dotted_loose', } _drawStyles_l = { @@ -1262,6 +1266,21 @@ def _draw_dotted(self, renderer, gc, path, trans): gc.set_dashes(self._dashOffset, self._dashSeq) renderer.draw_path(gc, path, trans) + def _draw_dashed_loose(self, renderer, gc, path, trans): + gc.set_linestyle('dashed@loose') + gc.set_dashes(self._dashOffset, self._dashSeq) + renderer.draw_path(gc, path, trans) + + def _draw_dash_dot_loose(self, renderer, gc, path, trans): + gc.set_linestyle('dashdot@loose') + gc.set_dashes(self._dashOffset, self._dashSeq) + renderer.draw_path(gc, path, trans) + + def _draw_dotted_loose(self, renderer, gc, path, trans): + gc.set_linestyle('dotted@loose') + 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) @@ -1452,7 +1471,8 @@ def get_solid_capstyle(self): def is_dashed(self): 'return True if line is dashstyle' - return self._linestyle in ('--', '-.', ':') + return self._linestyle in ('--', '-.', ':', '--@loose', '-.@loose', + ':@loose') class VertexSelector(object): diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index a5a248c156bd..f7406d00542b 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -925,6 +925,10 @@ def validate_animation_writer_path(p): 'lines.dashed_pattern': [[2.8, 1.2], validate_nseq_float()], 'lines.dashdot_pattern': [[4.8, 1.2, 0.8, 1.2], validate_nseq_float()], 'lines.dotted_pattern': [[1.1, 1.1], validate_nseq_float()], + 'lines.dashed@loose_pattern': [[2.8, 3.6], validate_nseq_float()], + 'lines.dashdot@loose_pattern': [[4.8, 3.6, 0.8, 3.6], + validate_nseq_float()], + 'lines.dotted@loose_pattern': [[1.1, 3.3], validate_nseq_float()], 'lines.scale_dashes': [True, validate_bool], # marker props diff --git a/matplotlibrc.template b/matplotlibrc.template index e57dfd9ada2d..ff6b71ce57c0 100644 --- a/matplotlibrc.template +++ b/matplotlibrc.template @@ -94,6 +94,9 @@ backend : $TEMPLATE_BACKEND #lines.dashed_pattern : 2.8, 1.2 #lines.dashdot_pattern : 4.8, 1.2, 0.8, 1.2 #lines.dotted_pattern : 1.1, 1.1 +#lines.dashed@loose_pattern : 2.8, 3.6 +#lines.dashdot@loose_pattern : 4.8, 3.6, 0.8, 3.6 +#lines.dotted@loose_pattern : 1.1, 3.3 #lines.scale_dashes : True #markers.fillstyle: full # full|left|right|bottom|top|none
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: