What does the sequence vector mean in matplotlib.pyplot.contour?

208 Views Asked by At

The contour from matplotlib supports a vector parameter V which description is:

draw contour lines at the values specified in sequence V, which must be in increasing order.

The MATLAB version of contour also supports a vector parameter, but it does not has this in increasing order restriction.

I want to know what does this vector means; do they have same/different meaning on these two platform.

More detailed information about what am I doing.

u = linspace(-1, 1.5, 50)
v = linspace(-1, 1.5, 50)
z = zeros((u.size, v.size))
# a loop to fill z
contour(u, v, z, [0, 0])

I need to set the 4th parameter to [0, 0] according to my tutorial. But I got

Contour levels must be increasing

Error. If I change it to [0, 1], the error is gone, but the contour does not look right.

1

There are 1 best solutions below

1
On

It seems that you create a contour plot of a flat function (constantly zero) which doesn't make sense IMHO. So you can define any ascending sequence like [-5, 0, 0.2, 1, 42], but you won't see the contour lines unless you have corresponding z values.