1
votes

I am plotting contour plots in matlab using vectors. I am using the contourf command for filled contour. The thing is that my data is discrete initially (only has values 0 & 1) but still matlab interpolates the color in the contour plot, which I don't want. I want only two colors for the plot - 0 defining black, 1 defining white. Also these colors should represent the actual data being plotted.

1
Could you add code example that you tired? And what result you expect? - anandr

1 Answers

1
votes

You need to specify levels in contourf:

%# create contours with colors indicating 0 and 1
contourf(X,Y,Z,[0 1])

%# set the colormap to black/white
colormap([0 0 0;1 1 1])