Why do XLim and YLim not work?
조회 수: 5 (최근 30일)
이전 댓글 표시
Hi! I'm quite new to Matlab and want to use it to plot some data. This is my code so far
figure(1), clf
dirs = {'1M', '3M', '15M','80M'};
colour={'k','r','g','b'};
for i=1:4
cd(dirs{i});
data = load('summary.txt');
Teff = data(:,6);
L = data(:,4);
semilogy(10.^Teff, 10.^L,colour{i}), hold on
cd '..'
end
labels = sort(str2num(get(gca,'YTickLabel')));
set(gca, 'XDir','reverse','YTickLabel',labels, 'YTick', [1 10 100 1000 10000 100000 1000000 10000000], 'XGrid', 'on')
xlabel('...')
ylabel('...')
mylegend = legend('1 M','3 M','15 M','80 M');
set(mylegend, 'Location', 'SouthWest')
Now, I want to limit the x- and y-axis and I added
set(gca, 'XLimMode', 'manual', 'XLim', [0 5], ...
Unfortunately after adding this I get the right x-axis limits, but everything before this command has dissapeared from the plot.
How can I add a x- and y-axis limitation to my plot without removing everything?
Thank you very much! Claude
댓글 수: 0
답변 (1개)
Walter Roberson
2013년 8월 25일
The content of your plot would disappear if you do not have at least one line segment that starts and ends within the range you set to (0 to 5, before log)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!