Plot graph not shown

3 次查看(过去 30 天)
Min
Min 2024-1-9
评论: Min 2024-1-10
Hi, I am currently using 'stackedplot' to plot all of my data (unfortunately I cannot change this to non-stacked plot due to iternative solutions) and due to number of plots, figure can't show all plots.
But I do need to show all the plots somehow.
I tried to use uipanel to adjust the side and made it scrollable but it wasn't still showing all plots.
Is there a way to adjust so that I can scroll to see all plots (variables?)
or alternative way to adjust by deselecting the plots like the 'plot browser'.
Here is the code I use.
figure (1)
penel1 = uipanel('parent',1);
panel2 = uipanel('Parent',penel1);
set(penel1,'Position',[0 0 1 1]);
set(panel2,'Position',[0 -1.8 1 3]);
set(gca,'Parent',panel2);
%figure data info
stackedplot(figure data info); % replace your stack plot fucntion here
s = uicontrol('Style','Slider','Parent',1,...
'Units','normalized','Position',[0.95 0 0.05 1],...
'Value',1,'Callback',{@slider_callback1,panel2});
function slider_callback1(src,eventdata,arg1)
val = get(src,'Value');
set(arg1,'Position',[0 -val 1 2])
end

回答(1 个)

Taylor
Taylor 2024-1-9
I would recommend tiledlayout instead. stackedplot seems to be dynamically resizing your plots, tiledlayout does not do this. Of course the individual x-axes are not handled quite as nicely as they are in stackedplot, but you can make those edits yourself (https://www.mathworks.com/help/matlab/ref/matlab.graphics.axis.axes-properties.html).
  3 个评论
Taylor
Taylor 2024-1-10
You won't need the uipanel/uicontrol/slider with tiledlayout because it is not dynamically sized. Play around with nRows in the code below and you'll see that even if you set it to a larger number like 50 all of the plots are still visible in the same window. How legible they are is a different question.
nRows = 15;
data = rand([nRows 10]);
f1 = figure;
tiledlayout(f1, nRows, 1)
for ii = 1:nRows
nexttile
plot(data(ii,:))
end
Min
Min 2024-1-10
Unfortunately, I couldn't find a way to use the tiledlayout for the problem I am seeing (maybe I am not expert enough haha). I tried to create for loop inside for loop since i would need to create multiple plots, figures, with various varibles that are contained in different formats of workspaces.
It got a little complicated sorry.! but thanks for your help! :)

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by