필터 지우기
필터 지우기

How to put plot inside a box

조회 수: 4 (최근 30일)
Atinesh Singh
Atinesh Singh 2017년 5월 6일
편집: Walter Roberson 2017년 5월 7일
I am using a below code to generate a plot as shown by 'Plot 1' and exporting it in '.eps' format so that I can use it in latex document.
figure;
hold
semilogy(XA, YA, ':k', 'LineWidth', 1);
semilogy(XB, YB, '--k', 'LineWidth', 1);
semilogy(XC, YC, '-k', 'LineWidth', 1);
xlabel('FEs');
ylabel('Fitness value');
legend('A', 'B', 'C');
title('Function');
print('figs/f1.eps','-depsc');
Plot 1
I want to put the plot inside a Box so that 'Plot 1' looks like 'Plot 2'
Plot 2
Is it possible to do it.

채택된 답변

Steven Lord
Steven Lord 2017년 5월 6일
See the box function.
  댓글 수: 1
Atinesh Singh
Atinesh Singh 2017년 5월 7일
I tried but it didn't worked.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2017년 5월 7일
편집: Walter Roberson 2017년 5월 7일
f = figure;
p = uipanel('Parent', f, 'Units', 'normal', 'Position', [0.05 0.05 0.9 0.9], 'bordertype', 'line', 'HighLightColor', [0 0 0]);
ax = axes('Parent', p, 'Units', 'normal', 'OuterPosition', [0 0 1 1]);
hold(ax, 'on')
semilogy(ax, XA, YA, ':k', 'LineWidth', 1);
semilogy(ax, XB, YB, '--k', 'LineWidth', 1);
semilogy(ax, XC, YC, '-k', 'LineWidth', 1);
xlabel(ax, 'FEs');
ylabel(ax, 'Fitness value');
legend({'A', 'B', 'C'});
title(ax, 'Function');
print(f, 'figs/f1.eps','-depsc');

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by