At the moment I'm plotting two points in a grid and I'm using the xlim and ylim to force the scale of my plot, like this
but I'd like to have a plot that changes dynamically the axis depending on where is my target. This because my red point might go above xlim and ylim or way below of it, like these two cases.
In the first one, the point is outside the window and therefore I cannot see it, while in the other case, the point is close to the origin of the plot and I'd like to see it more closely, like if I zoom in. For now I'm using
plot(x,y,'.','MarkerSize',20,'Color','r');
xlim([-a a]);
ylim([-a a]);
I think that to do what I need, I should use x,y somehow instead of a or a combination of the two in order to have a more dynamic range depending on the dimension of x,y.
Is there any other easier and faster way to do that?



