contour plots & linestyles

Hi,
  I just noted a strange behavior of contour(). When a contour plot is
created with negative values and using a single color instead of a cmap,
contour _always_ uses the contour.negative_linestyle, even if linestyles
are specifically provided:

  x = linspace(-pi,pi,100)
  X,Y = meshgrid(x,x)
  Z = cos(X) + 0.5*cos(Y)

  contour(X,Y,Z, colors='k', linestyles='solid')

I would expect the contour.negative_linestyle to be used when
linestyles=None, but not if it is explicitly specified. More serious,
even in the following case the effect takes place.

  contour_ls = ['solid']*9
  contour(X,Y,Z,10, colors='k', linestyles=contour_ls)

Should we consider this as a bug and fix it ???

mm

Manuel Metz wrote:

Hi,
  I just noted a strange behavior of contour(). When a contour plot is
created with negative values and using a single color instead of a cmap,
contour _always_ uses the contour.negative_linestyle, even if linestyles
are specifically provided:

  x = linspace(-pi,pi,100)
  X,Y = meshgrid(x,x)
  Z = cos(X) + 0.5*cos(Y)

  contour(X,Y,Z, colors='k', linestyles='solid')

I would expect the contour.negative_linestyle to be used when
linestyles=None, but not if it is explicitly specified. More serious,
even in the following case the effect takes place.

  contour_ls = ['solid']*9
  contour(X,Y,Z,10, colors='k', linestyles=contour_ls)

Should we consider this as a bug and fix it ???

Fixed. Thank you. Oh, rats. I forgot again--I need to put this in the maintenance branch, and your immediately preceding change probably should go there, too, so I will take care of both now.

Eric

Eric Firing wrote:

Manuel Metz wrote:

Hi,
  I just noted a strange behavior of contour(). When a contour plot is
created with negative values and using a single color instead of a cmap,
contour _always_ uses the contour.negative_linestyle, even if linestyles
are specifically provided:

  x = linspace(-pi,pi,100)
  X,Y = meshgrid(x,x)
  Z = cos(X) + 0.5*cos(Y)

  contour(X,Y,Z, colors='k', linestyles='solid')

I would expect the contour.negative_linestyle to be used when
linestyles=None, but not if it is explicitly specified. More serious,
even in the following case the effect takes place.

  contour_ls = ['solid']*9
  contour(X,Y,Z,10, colors='k', linestyles=contour_ls)

Should we consider this as a bug and fix it ???

Fixed. Thank you. Oh, rats. I forgot again--I need to put this in the
maintenance branch, and your immediately preceding change probably
should go there, too, so I will take care of both now.

Thanks ...

···

Eric