Function
spy uses plot , which cannot have different marker colors in the lineseries object.
On the other hand, a patch object can have different marker colors for different vertices. patch was originally designed to draw polygons, but without a complexion and no edge, you can get a similar plot result without a line style.
S = bucky(); [m, n] = size(S); [X, Y] = meshgrid(1:m, 1:n); S = (X + Y) .* S; nonzeroInd = find(S); [x, y] = ind2sub([mn], nonzeroInd); figure(); hp = patch(x, y, S(nonzeroInd), ... 'Marker', 's', 'MarkerFaceColor', 'flat', 'MarkerSize', 4, ... 'EdgeColor', 'none', 'FaceColor', 'none'); set(gca, 'XLim', [0, n + 1], 'YLim', [0, m + 1], 'YDir', 'reverse', ... 'PlotBoxAspectRatio', [n + 1, m + 1, 1]); colorbar();

You can easily use different color maps, for example colormap(flipud(hot)) .
