how to show all stackedplot variables on gui?
7 次查看(过去 30 天)
显示 更早的评论
function Spinner_d_2ValueChanged(app, event)
value = app.Spinner_d_2.Value;
d = uiprogressdlg(app.UIFigure,'Title','reading edf file...',...
'Indeterminate','on');
if app.info.NumSamples(1)*(value+app.Slider.Value)<size(app.data,1)
app.plotaxis = stackedplot(app.Panel,app.data(app.info.NumSamples(1)*app.Slider.Value+1:app.info.NumSamples(1)*(value+app.Slider.Value),:));
else
app.plotaxis = stackedplot(app.Panel,app.data(app.info.NumSamples(1)*app.Slider.Value+1:size(app.data,1),:));
end
app.Panel.Position(2) = app.fileList.Position(2);
app.Panel.Position(4) = app.fileList.Position(4);
app.plotaxis.XLabel = "";
app.plotaxis.XLimits = [0 app.info.NumSamples(1)*value];
app.timeplus(app.Slider.Value);
close(d)
end
i make a stackedplot in the panel,but as the image show that i still have space for it but those 6 variables just dont show,how can i fix this?
like make a scrollbar for it?(if yes then how to?)
4 个评论
dpb
2022-5-15
编辑:dpb
2022-5-15
My bad, that was from memory -- I was thinking I remembered besides the zoom w/ scroll there was a pan function that would show the others. In checking, that was a false memory -- would be good enhancement request it would seem.
All it really does that was my suggestion is that if you start with a given figure size, there will be some number shown based on that figure; in a regular figure at least, if you make it taller, it will refresh with some new number to fit that size with an internal callback function. I do not know how that acts in a uifigure in an app; haven't tried it. It's not actually a pan, just automatically adjusts the number to the figure size; one can have more than it will put on a figure that takes the full monitor height. I haven't tried seeing if can make the figure window itself taller than the screen/monitor size and if it will scroll; that would be only other possibility I can see with system/OS level behavior.
You aren't given access to the individual axes and hold on is ignored so you can't do any real customization.
I think the only thing you can do with a stackedplot object in this case will be to add a user button w/ a callback that would then display the other section of those not displayed by default(*); stackedplot is basically "what you see is what you get" and that's about it with the exception of some minor cosmetics.
(*) That would entail drawing a new stackedplot with the alternate selection of variables from the end up.
Carina Schwab
2022-11-23
If you put the stackedplot in a GridLayout then set the Scrollable property of the GridLayout to "on" and the RowHeight to a multiple of the number of plots in the stackedplot, you can control the height of the single plots in the stackedplot and get a scrollbar:
glayout.Scrollable = "on"
glayout.RowHeight = {70 * numberOfPlots}.
This is still not ideal and I would wish for a better solution because:
- For some reason a big amount of empty space is shown above the stackedplot.
- When exploring values the x value is only shown on the top of the stackedplot.
- When hovering over the stackedplot with the mouse you would like to scroll to explore all values at this point of time but using the mouse wheel will zoom into the plot. (But I guess you can implement your own solution for scrolling.)
回答(1 个)
Abhishek Chakram
2023-12-27
Hi 詠嶸 黃,
It appears to me that you want to show all the stacked plots on the figure window. You can use “uipanel” to achieve the same. The “uipanel” allows you to add scrollbars to the figure window.
Kindly refer to the following MATLAB Answer to know how to integrate “uipanel” and add scrollbars to the figure window: https://www.mathworks.com/matlabcentral/answers/97964-how-can-i-use-scrollbars-in-matlab-figure-windows-when-viewing-large-guis
You can also refer to the following documentation to know more about “uipanel”: https://www.mathworks.com/help/matlab/ref/uipanel.html
Best Regards,
Abhishek Chakram
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!