Why do XLim and YLim not work?

5 visualizaciones (últimos 30 días)
Claude
Claude el 25 de Ag. de 2013
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

Respuestas (1)

Walter Roberson
Walter Roberson el 25 de Ag. de 2013
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)

Categorías

Más información sobre Legend en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by