can't keep figure handle hidden when using "fill" w/subplots

4 views (last 30 days)
I want to use "fill" command for a specific subplot. I am using the "tight_subplot" function found here in the forums. I am able to control/set all properties and plot to each subplot individually, but i haven't figured out how to use fill on a specific subplot without having to use "axes(1)" which then sets the visibility back to 'on' for FIG.
My goal is keep "FIG" hidden at all times, but still apply my "fill" command to a specific subplot.
%define a figure handle and keep it hidden. create the subplots
FIG = figure('doublebuffer','off','Visible','Off');
sub = tight_subplot(2,2,[0.095 0.11],[0.06 0.07],[0.075 0.075]);
set(FIG,'Units','pixels','Position',[25 450 900 810]);
% set some limits on the subplots
set(sub(1:4),...
'drawmode','fast',...
'xlim',[0 samples],...
'YLim',[(min-0.015) (max+0.015)],...
'YTickLabelMode','auto',...
'Xtick',(0:(2*samples)/8:2*samples));
xlabel(sub(1),'this is the X label');
ylabel(sub(1),'Y scale');
title(sub(1),'some title_ thing','FontWeight','bold','Interpreter','none');
%plot some stuff to sub(1)
hold(sub(1),'on');
plot(sub(1),[0,samples],[val1 val1], 'r--')
plot(sub(1),wv1_segs,'g');
% now i want to plot with the "fill" command. I also want to apply this last to keep its boundaries over top of the stuff i already plotted above.
% without this axes call, the fill command uses the coordinates of the entire "FIG" (ie: all 4 subplots) and writes over them. i only want this applied specifically to subplot1 for example.
axes(sub(1));
xVALS = [floor(0.5*samples),floor(0.75*samples),floor(samples),floor(0.75*samples)];
yVALS = [0, 50e-3, 0, -50e-3];
fill(xVALS,yVALS,'b');

Accepted Answer

Walter Roberson
Walter Roberson on 25 Aug 2015
fill(xVALS,yVALS,'b', 'Parent', sub(1));

More Answers (0)

Community Treasure Hunt

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

Start Hunting!