matplotlib 3d contour_plot颜色级别

时间:2015-07-30 16:53:45

标签: python matplotlib colors 3d contour

如何更改3d matplotlib plot_surface中离散色彩级别的数量?

e.g

    normalisation = matplotlib.colors.Normalize(vmin=numpy.amin(Z), vmax=numpy.amax(Z))
    axis.plot_surface(X,Y,Z,cmap=matplotlib.pyplot.cm.Greys,norm=normalisation)

但是N级色彩超过标准化范围?

1 个答案:

答案 0 :(得分:0)

请尝试将其用于规范化,其中n是级别数:

cmap = matplotlib.pyplot.cm.Greys
bounds = numpy.linspace(numpy.amin(Z),numpy.amax(Z), n + 1)
normalisation = matplotlib.colors.BoundaryNorm(bounds, cmap.N)