Skip to content

Commit fd54ced

Browse files
committed
Use 'dashed' | 'solid' to specify contour negative linestyle
svn path=/trunk/matplotlib/; revision=3384
1 parent d3d7cb4 commit fd54ced

File tree

5 files changed

+46
-34
lines changed

5 files changed

+46
-34
lines changed

CHANGELOG

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2007-06-10 In matplotlibrc file, use 'dashed' | 'solid' instead
2+
of a pair of floats for contour.negative_linestyle - EF
3+
14
2007-06-08 Allow plot and fill fmt string to be any mpl string
25
colorspec - EF
36

lib/matplotlib/__init__.py

+17-9
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,13 @@ def enumerate(seq):
199199
yield i, seq[i]
200200

201201

202+
def is_string_like(obj):
203+
if hasattr(obj, 'shape'): return 0 # this is a workaround
204+
# for a bug in numeric<23.1
205+
try: obj + ''
206+
except (TypeError, ValueError): return 0
207+
return 1
208+
202209

203210
def _is_writable_dir(p):
204211
"""
@@ -697,6 +704,14 @@ def validate_usetex(s):
697704

698705
validate_capstyle = ValidateInStrings(['butt', 'round', 'projecting'], ignorecase=True)
699706

707+
def validate_linecol_linestyle(s):
708+
try:
709+
dashes = validate_nseq_float(2)(s)
710+
warnings.warn("Deprecated negative_linestyle specification; use 'solid' or 'dashed'")
711+
return (0, dashes) # (offset, (solid, blank))
712+
except ValueError:
713+
V = ValidateInStrings(['solid', 'dashed'], ignorecase=True)
714+
return(V(s))
700715

701716
class ValidateInterval:
702717
"""
@@ -791,10 +806,10 @@ def __call__(self, s):
791806
'image.lut' : [256, validate_int], # lookup table
792807
'image.origin' : ['upper', str], # lookup table
793808

794-
'contour.negative_linestyle' : [(6.0,6.0), validate_nseq_float(2)],
809+
'contour.negative_linestyle' : ['dashed', validate_linecol_linestyle],
795810

796811
# axes props
797-
'axes.axisbelow' : [False, validate_bool],
812+
'axes.axisbelow' : [False, validate_bool],
798813
'axes.hold' : [True, validate_bool],
799814
'axes.facecolor' : ['w', validate_color], # background color; white
800815
'axes.edgecolor' : ['k', validate_color], # edge color; black
@@ -1143,13 +1158,6 @@ def interactive(b):
11431158
"""
11441159
rcParams['interactive'] = b
11451160

1146-
def is_string_like(obj):
1147-
if hasattr(obj, 'shape'): return 0 # this is a workaround
1148-
# for a bug in numeric<23.1
1149-
try: obj + ''
1150-
except (TypeError, ValueError): return 0
1151-
return 1
1152-
11531161
def is_interactive():
11541162
'Return true if plot mode is interactive'
11551163
b = rcParams['interactive']

lib/matplotlib/contour.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ def __init__(self, ax, *args, **kwargs):
472472
linewidths = width)
473473

474474
if level < 0.0 and self.monochrome:
475-
col.set_linestyle((0, rcParams['contour.negative_linestyle']))
475+
ls = rcParams['contour.negative_linestyle']
476+
col.set_linestyle(ls)
476477
col.set_label('_nolegend_')
477478
self.ax.add_collection(col)
478479
self.collections.append(col)

lib/matplotlib/mpl-data/matplotlibrc

+12-12
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,27 @@ units : True
123123
#text.color : black
124124

125125
### LaTeX customizations. See http://www.scipy.org/Wiki/Cookbook/Matplotlib/UsingTex
126-
#text.usetex : False # use latex for all text handling. The following fonts
126+
#text.usetex : False # use latex for all text handling. The following fonts
127127
# are supported through the usual rc parameter settings:
128128
# new century schoolbook, bookman, times, palatino,
129-
# zapf chancery, charter, serif, sans-serif, helvetica,
130-
# avant garde, courier, monospace, computer modern roman,
129+
# zapf chancery, charter, serif, sans-serif, helvetica,
130+
# avant garde, courier, monospace, computer modern roman,
131131
# computer modern sans serif, computer modern typewriter
132132
# If another font is desired which can loaded using the
133-
# LaTeX \usepackage command, please inquire at the
133+
# LaTeX \usepackage command, please inquire at the
134134
# matplotlib mailing list
135135
#text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
136136
# unicode strings.
137137
#text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
138138
# AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
139139
# IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.
140-
# preamble is a comma separated list of LaTeX statements
141-
# that are included in the LaTeX document preamble.
140+
# preamble is a comma separated list of LaTeX statements
141+
# that are included in the LaTeX document preamble.
142142
# An example:
143143
# text.latex.preamble : \usepackage{bm},\usepackage{euler}
144-
# The following packages are always loaded with usetex, so
145-
# beware of package collisions: color, geometry, graphicx,
146-
# type1cm, textcomp. Adobe Postscript (PSSNFS) font packages
144+
# The following packages are always loaded with usetex, so
145+
# beware of package collisions: color, geometry, graphicx,
146+
# type1cm, textcomp. Adobe Postscript (PSSNFS) font packages
147147
# may also be loaded, depending on your font settings
148148
#text.dvipnghack : False # some versions of dvipng don't handle
149149
# alpha channel properly. Use True to correct and flush
@@ -232,7 +232,7 @@ units : True
232232

233233

234234
### CONTOUR PLOTS
235-
#contour.negative_linestyle : 6.0, 6.0 # negative contour dashstyle (size in points)
235+
#contour.negative_linestyle : dashed # dashed | solid
236236

237237
### SAVING FIGURES
238238
# the default savefig params can be different for the GUI backends.
@@ -257,14 +257,14 @@ units : True
257257

258258
# pdf backend params
259259
#pdf.compression : 6 # integer from 0 to 9
260-
# 0 disables compression (good for debugging)
260+
# 0 disables compression (good for debugging)
261261

262262
# svg backend params
263263
#svg.image_inline : True # write raster image data directly into the svg file
264264
#svg.image_noscale : False # suppress scaling of raster data embedded in SVG
265265

266266
# Set the verbose flags. This controls how much information
267-
# matplotlib gives you at runtime and where it goes. Ther verbosity
267+
# matplotlib gives you at runtime and where it goes. The verbosity
268268
# levels are: silent, helpful, debug, debug-annoying. Any level is
269269
# inclusive of all the levels below it. If you setting is debug,
270270
# you'll get all the debug and helpful messages. When submitting

matplotlibrc.template

+12-12
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,27 @@ units : True
123123
#text.color : black
124124

125125
### LaTeX customizations. See http://www.scipy.org/Wiki/Cookbook/Matplotlib/UsingTex
126-
#text.usetex : False # use latex for all text handling. The following fonts
126+
#text.usetex : False # use latex for all text handling. The following fonts
127127
# are supported through the usual rc parameter settings:
128128
# new century schoolbook, bookman, times, palatino,
129-
# zapf chancery, charter, serif, sans-serif, helvetica,
130-
# avant garde, courier, monospace, computer modern roman,
129+
# zapf chancery, charter, serif, sans-serif, helvetica,
130+
# avant garde, courier, monospace, computer modern roman,
131131
# computer modern sans serif, computer modern typewriter
132132
# If another font is desired which can loaded using the
133-
# LaTeX \usepackage command, please inquire at the
133+
# LaTeX \usepackage command, please inquire at the
134134
# matplotlib mailing list
135135
#text.latex.unicode : False # use "ucs" and "inputenc" LaTeX packages for handling
136136
# unicode strings.
137137
#text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES
138138
# AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP
139139
# IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO.
140-
# preamble is a comma separated list of LaTeX statements
141-
# that are included in the LaTeX document preamble.
140+
# preamble is a comma separated list of LaTeX statements
141+
# that are included in the LaTeX document preamble.
142142
# An example:
143143
# text.latex.preamble : \usepackage{bm},\usepackage{euler}
144-
# The following packages are always loaded with usetex, so
145-
# beware of package collisions: color, geometry, graphicx,
146-
# type1cm, textcomp. Adobe Postscript (PSSNFS) font packages
144+
# The following packages are always loaded with usetex, so
145+
# beware of package collisions: color, geometry, graphicx,
146+
# type1cm, textcomp. Adobe Postscript (PSSNFS) font packages
147147
# may also be loaded, depending on your font settings
148148
#text.dvipnghack : False # some versions of dvipng don't handle
149149
# alpha channel properly. Use True to correct and flush
@@ -232,7 +232,7 @@ units : True
232232

233233

234234
### CONTOUR PLOTS
235-
#contour.negative_linestyle : 6.0, 6.0 # negative contour dashstyle (size in points)
235+
#contour.negative_linestyle : dashed # dashed | solid
236236

237237
### SAVING FIGURES
238238
# the default savefig params can be different for the GUI backends.
@@ -257,14 +257,14 @@ units : True
257257

258258
# pdf backend params
259259
#pdf.compression : 6 # integer from 0 to 9
260-
# 0 disables compression (good for debugging)
260+
# 0 disables compression (good for debugging)
261261

262262
# svg backend params
263263
#svg.image_inline : True # write raster image data directly into the svg file
264264
#svg.image_noscale : False # suppress scaling of raster data embedded in SVG
265265

266266
# Set the verbose flags. This controls how much information
267-
# matplotlib gives you at runtime and where it goes. Ther verbosity
267+
# matplotlib gives you at runtime and where it goes. The verbosity
268268
# levels are: silent, helpful, debug, debug-annoying. Any level is
269269
# inclusive of all the levels below it. If you setting is debug,
270270
# you'll get all the debug and helpful messages. When submitting

0 commit comments

Comments
 (0)