Axis not working with loglog

11 visualizaciones (últimos 30 días)
Vasko Nechev
Vasko Nechev el 7 de Sept. de 2020
Comentada: Vasko Nechev el 7 de Sept. de 2020
I am trying to extend the axis of my LogLog plot using axis, but I cannot. Can someone explain how to fix this? Thanks
y=[1001 892 749 688 576 472 385 361];
x=[214 706 3000 9500 28000 78000 500000 1100000];
yticks([0 100 200 600 1200])
xticks([0 1 10 10^2 10^3 10^4 10^5 10^6])
axis([0 1200000 0 1200])
loglog(x,y,'o-')
hold on
grid on
It should start at 0,0 and go to 1200000,1200.

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 7 de Sept. de 2020
Simple reason: log10(0) is a very small "number". So that is an impossible request. Also when you set the axis limits before plotting the actual plotting command gives you a new axis limits - that are determined by the data you plot.
Even if you tried to set the minimum value to 0 in a log-scaled axis you would run into a fall-back (as I understand this) that the minimum axis-limits are set to something like the best value smaller minimum data-value.
HTH
  1 comentario
Vasko Nechev
Vasko Nechev el 7 de Sept. de 2020
I initially set the axis limits after the loglog function. However, I simply changed my axis lower limits from 0,0 to 1,1... That worked! Makes sense, Matlab must have not liked a 0,0 origin for axis([]) in loglog
Thanks so much! :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Labels and Styling 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