Why do XLim and YLim not work?

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

답변 (1개)

Walter Roberson
Walter Roberson 2013년 8월 25일

1 개 추천

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)

카테고리

태그

질문:

2013년 8월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by