Skip to content

ENH: Stricter validation of line style rcParams (and extended accepted types for grid.linestyle) #8040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Feb 18, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use validate_linestyle even for rcParam 'contour.negative_linestyle'
  • Loading branch information
afvincent committed Feb 10, 2017
commit e8032dff30c077a6e3afece034b59c9294ee4df0
19 changes: 1 addition & 18 deletions lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,22 +530,6 @@ def validate_ps_distiller(s):
'top', 'none'])
validate_fillstylelist = _listify_validator(validate_fillstyle)

validate_negative_linestyle = ValidateInStrings('negative_linestyle',
['solid', 'dashed'],
ignorecase=True)


def validate_negative_linestyle_legacy(s):
try:
res = validate_negative_linestyle(s)
return res
except ValueError:
dashes = validate_nseq_float(2)(s)
warnings.warn("Deprecated negative_linestyle specification; use "
"'solid' or 'dashed'",
mplDeprecation)
return (0, dashes) # (offset, (solid, blank))


def validate_corner_mask(s):
if s == 'legacy':
Expand Down Expand Up @@ -1081,8 +1065,7 @@ def validate_linestyle(ls):
'image.composite_image': [True, validate_bool],

# contour props
'contour.negative_linestyle': ['dashed',
validate_negative_linestyle_legacy],
'contour.negative_linestyle': ['dashed', validate_linestyle],
'contour.corner_mask': [True, validate_corner_mask],

# errorbar props
Expand Down
2 changes: 1 addition & 1 deletion matplotlibrc.template
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ backend : $TEMPLATE_BACKEND
# such as a PDF.

### CONTOUR PLOTS
#contour.negative_linestyle : dashed # dashed | solid
#contour.negative_linestyle : dashed # string or on-off ink sequence
#contour.corner_mask : True # True | False | legacy

### ERRORBAR PLOTS
Expand Down