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

조회 수: 4 (최근 30일)
cmmv
cmmv 2015년 8월 25일
댓글: cmmv 2015년 8월 27일
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');

채택된 답변

Walter Roberson
Walter Roberson 2015년 8월 25일
fill(xVALS,yVALS,'b', 'Parent', sub(1));

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by