27c2dc10bb9f83026db6378c151d8108fc044af8,examples/images_contours_and_fields/contour_demo.py,,,#,16

Before Change


// You can set negative contours to be solid instead of dashed:

matplotlib.rcParams["contour.negative_linestyle"] = "solid"
plt.figure()
CS = plt.contour(X, Y, Z, 6,
                 colors="k",  // negative contours will be dashed by default
                 )
plt.clabel(CS, fontsize=9, inline=1)

After Change


                 colors="k",  // negative contours will be dashed by default
                 )
ax.clabel(CS, fontsize=9, inline=1)
ax.set_title("Single color - negative contours solid")


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// And you can manually specify the colors of the contour

fig, ax = plt.subplots()
CS = ax.contour(X, Y, Z, 6,
                 linewidths=np.arange(.5, 4, .5),
                 colors=("r", "green", "blue", (1, 1, 0), "//afeeee", "0.5")
                 )
ax.clabel(CS, fontsize=9, inline=1)
ax.set_title("Crazy lines")


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Or you can use a colormap to specify the colors; the default
// colormap will be used for the contour lines

fig, ax = plt.subplots()
im = ax.imshow(Z, interpolation="bilinear", origin="lower",
                cmap=cm.gray, extent=(-3, 3, -2, 2))
levels = np.arange(-1.2, 1.6, 0.2)
CS = ax.contour(Z, levels, origin="lower", cmap="flag",
                linewidths=2, extent=(-3, 3, -2, 2))

// Thicken the zero contour.
zc = CS.collections[6]
plt.setp(zc, linewidth=4)

ax.clabel(CS, levels[1::2],  // label every second level
          inline=1, fmt="%1.1f",
          cmap="flag", fontsize=14)

// make a colorbar for the contour lines
CB = fig.colorbar(CS, shrink=0.8, extend="both")

ax.set_title("Lines with colorbar")

// We can still add a colorbar for the image, too.
CBI = fig.colorbar(im, orientation="horizontal", shrink=0.8)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: matplotlib/matplotlib
Commit Name: 27c2dc10bb9f83026db6378c151d8108fc044af8
Time: 2018-06-27
Author: jklymak@gmail.com
File Name: examples/images_contours_and_fields/contour_demo.py
Class Name:
Method Name:


Project Name: matplotlib/matplotlib
Commit Name: ec5e8863a6352da673b55cb971529f38278cf64e
Time: 2018-03-26
Author: pmhobson@gmail.com
File Name: examples/images_contours_and_fields/contour_demo.py
Class Name:
Method Name:


Project Name: matplotlib/matplotlib
Commit Name: 9937d332ee11207ff2c01501cf3e1a8d5127fbb9
Time: 2019-12-02
Author: 2836374+timhoffm@users.noreply.github.com
File Name: examples/misc/zorder_demo.py
Class Name:
Method Name: