Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9399edd

Browse files
author
Jeff Whitaker
committed
show proper way to change dash pattern of negative contours.
svn path=/trunk/matplotlib/; revision=3320
1 parent 8c27731 commit 9399edd

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

examples/contour_demo.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,23 @@
3232

3333

3434
# You can force all the contours to be the same color.
35-
# Use colors = 'k' to make negative contours dashed;
36-
# use colors = ('k',) to leave all contours solid.
3735
figure()
3836
CS = contour(X, Y, Z, 6,
39-
colors='k', # or ('k',) for all solid
37+
colors='k', # negative contours will be dashed by default
4038
)
4139
clabel(CS, fontsize=9, inline=1)
42-
title('Single color')
40+
title('Single color - negative contours dashed')
41+
42+
# You can set the dash pattern for negative contours
43+
# (default is dashed). Specified as (on, off) in pixels.
44+
# Making the second element of the tuple zero yields solid lines.
45+
rcParams['contour.negative_linestyle'] = (6,0)
46+
figure()
47+
CS = contour(X, Y, Z, 6,
48+
colors='k', # negative contours will be dashed by default
49+
)
50+
clabel(CS, fontsize=9, inline=1)
51+
title('Single color - negative contours solid')
4352

4453

4554
# And you can manually specify the colors of the contour

0 commit comments

Comments
 (0)