How to freeze the range of y-axis on an axes on gui?
72 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to plot the time audio signal using plot(handles.axes1, x) which works fine. The problem is that I cannot make the make the range of a y-axis fix at [-1 1]. I try to set the YLim to be [-1, 1], and YLimMode to be 'manual' both in property windows settings using gui and also in callcall back
0 comentarios
Respuestas (3)
Dario Mangoni
el 11 de Dic. de 2018
Editada: Dario Mangoni
el 11 de Dic. de 2018
Currently (at R2018b) this operation is made easy through 'axis manual' command.
figure;
hold on;
plot(1,1,'+')
plot(2,2,'+')
axis manual
plot(50,50,'+')
The point (50,50) is not in view because axis limits has been retained.
0 comentarios
Matt J
el 28 de Ag. de 2015
Editada: Matt J
el 28 de Ag. de 2015
It is not enough to set YLimMode to 'manual'. You need to apply "hold on" as Geoff mentioned. However, you can still use CLA to clear the plot between re-renderings, like in the example below.
axis([0,11,-1,1]);
h=gca;
hold on
h.YLimMode='manual';
for i=1:100,
plot(1:10,rand(1,10));
pause(.3);
drawnow
cla
end
hold off
0 comentarios
Geoff Hayes
el 2 de Feb. de 2015
Try using ylim which will allow you to set the y-axis limits. In your case, you could do something like
ylim(handles.axes1,[-1 1]);
In order to keep these limits, you may need to call
hold(handles.axes1,'on');
so that you return the current properties of the axes before a new plot is added to it.
2 comentarios
Geoff Hayes
el 4 de Feb. de 2015
Why not just replace the x and y data from the previous segment? Something like
% plot the first segment
h = plot(x,y);
% use the handle from plot, h, to update with the new segment data
set(h,'XData',xNewSeg,'YData',yNewSeg);
where xNewSeg and yNewSeg are the x and y data from the new segment.
Ver también
Categorías
Más información sobre Geographic Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!