Plot graph not shown

조회 수: 7 (최근 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에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by