Skip to content

Commit a764e9f

Browse files
committed
Use symbolic operator names (moveto, lineto) in contour_manual example.
It's clearer to directly use the names (or their one-letter abbreviations M/L, which are e.g. part of the svg standard) that using numeric values and then explaining the numeric values.
1 parent 6767738 commit a764e9f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

galleries/examples/misc/contour_manual.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
66
Example of displaying your own contour lines and polygons using ContourSet.
77
"""
8+
89
import matplotlib.pyplot as plt
910

1011
import matplotlib.cm as cm
1112
from matplotlib.contour import ContourSet
13+
from matplotlib.path import Path
1214

1315
# %%
1416
# Contour lines for each level are a list/tuple of polygons.
@@ -43,11 +45,12 @@
4345
# Multiple filled contour lines can be specified in a single list of polygon
4446
# vertices along with a list of vertex kinds (code types) as described in the
4547
# Path class. This is particularly useful for polygons with holes.
46-
# Here a code type of 1 is a MOVETO, and 2 is a LINETO.
4748

4849
fig, ax = plt.subplots()
4950
filled01 = [[[0, 0], [3, 0], [3, 3], [0, 3], [1, 1], [1, 2], [2, 2], [2, 1]]]
50-
kinds01 = [[1, 2, 2, 2, 1, 2, 2, 2]]
51+
M = Path.MOVETO
52+
L = Path.LINETO
53+
kinds01 = [[M, L, L, L, M, L, L, L]]
5154
cs = ContourSet(ax, [0, 1], [filled01], [kinds01], filled=True)
5255
cbar = fig.colorbar(cs)
5356

0 commit comments

Comments
 (0)