Slider which controls a bar plot
이전 댓글 표시
Hello everyone,
i would like to get a slider which controls a bar plot.
so i got this, but instead of the gauge i would like to have a bar plot which is changing while i move the slider.
at the end i need 4 - 5 different bars which are chancing individually depending on different functions. and there is a same variable which is in each functions and this should be the input from the slider.
function sliderchanging
% Create figure window and components
fig = uifigure('Position',[100 100 350 275]);
cg = uigauge(fig,'Position',[100 100 120 120]);
cg.MajorTicks = [0:10:100];
cg.MajorTickLabels = {'0','10','20','30','40','50','60','70','80','90','100'};
sld = uislider(fig,...
'Position',[100 75 120 3],'ValueChangingFcn',@(sld,event) sliderMoving(event,cg));
end
% Create ValueChangingFcn callback
function sliderMoving(event,cg)
cg.Value = event.Value;
end
댓글 수: 2
Adam Danz
2021년 2월 7일
Could you elaborate on the goal? I don't understand how the slider should affect the bar plot.
Karl Philip Hahne
2021년 2월 8일
채택된 답변
추가 답변 (1개)
Mario Malic
2021년 2월 5일
편집: Mario Malic
2021년 2월 5일
0 개 추천
Hello,
here's an answer to a very similar question.
댓글 수: 3
Karl Philip Hahne
2021년 2월 7일
Mario Malic
2021년 2월 8일
Just a note from the heatmap solution to get you started. Heatmap chart requires a figure or uifigure to plot, whereas bar chart requires axes or uiaxes to plot.
See the documentation for bar and do the first example to start with.
Since this is a homework task, show us what have you done so far so we can help you with it.
Karl Philip Hahne
2021년 2월 8일
카테고리
도움말 센터 및 File Exchange에서 Bar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
