Question

A simple question. I have a figure. I need to hold it, and put some dots on it using scatter plot. Figure has a colormap(jet). I want these new dots to be black. I tried using caxis.

This is what I did:

cmap=colormap(jet);cmap=[[0;0;0]';cmap;[1;1;1]'];caxis([-pi pi]);colormap(cmap);

I set the values of new dots to 10 or -10. So they are black or white. But the lowest values or highest values in my original image is also black or white. Since the caxis works as less that or equal to basis.

If you can suggest some other method, thats also fine.

Thanks in advance.

N

Was it helpful?

Solution

I can think of two approaches.

  1. if you do the scatterplot with line or plot you can specify the color: line(x_data,y_data,'Color','k') (k is black).

  2. you can draw the scatter plot in a second axis which you overlay. Following command should do most of the work (but maybe you should adjust):


a1 = gca;

a2 = axis('Color','none'... % to make it transparent
,'Position',get(a1,'Positon')... % to have it at exactly the same position
,'XLim',get(a1,'XLim')... % same xrange
,'YLim',get(a1,'YLim')... % same yrange
,'XTick',[],'YTick',[]) % turn of ticks as they are already in the other axis
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top