How can I create a plot where the graph shifts as the data extends?
    5 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
Hey all,
I want to make a pressure vs time graph that shifts the graph over to the right as time extends. I don't want to keep the old data in view. How can I do this?
Here's the current code:
hold on
for i=1:21598          %number of data points
    ylim([0 60])
    plot((data.time(i)-datenum(2013,01,00)),data.P(i));
    drawnow;
    pause(.1);
end
Right now the code plots the data, but keeps auto sizing the graph as the number of points increase. It also gets really slow as more points are added.
0 comentarios
Respuestas (3)
  the cyclist
      
      
 el 12 de Jul. de 2013
        Does this help?
figure
hold on
dd = data.time - datenum(2013,01,00);
for i=1:21598          %number of data points
    plot(dd(i),data.P(i));
    ylim([0 60])
    drawnow;
    pause(.1);
end
0 comentarios
  chef13
      
 el 8 de Ag. de 2013
        I solved plotting and then write:
xlim([i-50,i+50])
Let me know if this helps, Fabrizio.
0 comentarios
  Iain
      
 el 8 de Ag. de 2013
         a = plot(((data.time(1)-datenum(2013,01,00)),data.P(1));
 for i = 1:21598
  set(a,'Xdata',data.time(i)-datenum(2013,01,00)),'YData',data.P(i))
  axis([desired_xmin, desired_xmin+desired_range, 0 60])
  drawnow
 end
0 comentarios
Ver también
Categorías
				Más información sobre Graphics Performance 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!



