How do I add a horizontal scroll bar to a figure

24 visualizaciones (últimos 30 días)
Chris McNab
Chris McNab el 15 de Sept. de 2014
Comentada: Niha Afzal el 21 de Nov. de 2020
I have alot of data spread horizontally across my figure and I would like the user to be able to scroll across the figure to see data that cannot be displayed on the screen.

Respuestas (2)

Michael Haderlein
Michael Haderlein el 15 de Sept. de 2014
Easiest in my opinion is to use a panel as container for all controls you want to move. A minimal example is the following:
function test
hf=figure;
hpanel=uipanel('position',[0 .05 2 .95]);
hscrollbar=uicontrol('style','slider','units','normalized','position',[0 0 1 .05],'callback',@hscroll_Callback);
axes('parent',hpanel,'outerposition',[.25 0 .5 1])
plot(rand(5))
function hscroll_Callback(src,evt)
set(hpanel,'position',[-get(src,'value') 0.05 2 .95])
end
end
Best regards, Michael

E Zakreski
E Zakreski el 8 de Abr. de 2016
I made a scroll bar class Linked here. If you want to scroll through a plot horizontally use the function:
  • scrollablePlot({'XData', xdata, 'YData', ydata,_other plot properties_}, {'X'});
You can also made another function you may want to try this function
  1 comentario
Niha Afzal
Niha Afzal el 21 de Nov. de 2020
Can you please explain how I can use your function to get a horizonntal scroll bar ... but i need to use my "plot function". My files are plotting the data only for fisrt 10 sec ... my entire data is of 3600 sec I need to display 10 sec data/ axis using horizontal scroll bar... can you help?

Iniciar sesión para comentar.

Categorías

Más información sobre Annotations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by