0
votes

I've added a number of timeseries to a figures object in Matlab and plotted them as subplots on the graph to display them all together, one after the other. There can be a dynamic number of timeseries plots, I can't know in advance how many there will be.

Unfortunately what seems to be happening is that the figures plot is not expanding to include a scroll bar as new subplots are added. Is there a particular flag I'm not seeing to include this and stop the plots in my figures object from getting smaller and smaller?

As an example:

%Maximise the figure window to full screen
    f = figure;
    f=gcf;
    f.Units='normalized';
    f.OuterPosition=[0 0 1 1];

    %Add a panel to the figure, we'll add subplots to this
    p = uipanel('Parent',f,'BorderType','none'); 
    p.Title = 'Examples'; 
    p.TitlePosition = 'centertop'; 
    p.FontSize = 12;
    p.FontWeight = 'bold';

    %Add a timeseries subplot to the panel
    subplot((length(motifIndexAfterThresholds)*2)+1,1,1, 'Parent',p)
    ts0 = timeseries(E4_hrX(startIndex:endIndex),'Name','Parent Motif');
    plot(ts0)
    title('Parent')

After this point I could add in as many subplots as I like, but the panel is not stretching as I'd have hoped.

If anyone can offer suggestions I'd very much appreciate it.

1

1 Answers

0
votes

Anyone with the same problem, check out this (2011) blog post: https://blogs.mathworks.com/pick/2011/11/23/scrolling-figures-guis/

It turns out that a user submitted function can provide this functionality, and all we need to do is download that .m file, include it in your Matlab path, change the function call from subplot to scrollsubplot in our code.

No idea if this will work long term, a feature like this probably should be included out of the box by matlab itself.