do not display first value on the x axis

hi,
have the code below
y=[6 6.25 6.33 6.45 7 7.2 7.1 7.4 7.5 7.3 7.6 7.4 7.4 7.5 7.4 7.2 6.8 6.6 6.7 6.8 6.9 6.3 6.2 6.5 6.9 7.3 7.5 7.6 7.4 7.2 6.9 6.7 6.8 6.5 7.2 7.6 8.2 7.4 7.2 6.7 6.5 7.2 7.5 7.7 7.4 7.6 7.2 7.3 7.1 6.9 6.3]
x=[0:0.02:1]
plot(x,y)
xlabel('Time');
ylabel('Stock price');
xlim = get(gca,'XLim');
h = line(xlim,[7 7]);
set(h,'LineStyle',':')
axis([0 1 5 9])
set(gca,'XTickLabel',0.1:0.1:1)
set(gca,'Box','off')
I thought that with set(gca,'XTickLabel',0.1:0.1:1) the rist value on the x axis is not shown and therefore the first value of the x-axis and the first value of the y-axis aren't that near together, but for whatever strange reason this is not working, could someone help me?

 Respuesta aceptada

the cyclist
the cyclist el 31 de Mzo. de 2013
You probably wanted to change the tick locations and not just the labels:
set(gca,'XTick',0.1:0.1:1)
set(gca,'XTickLabel',0.1:0.1:1)

3 comentarios

Locks
Locks el 31 de Mzo. de 2013
thanks, it's working. could you explain me the difference between xtick and xticklabel?
the cyclist
the cyclist el 31 de Mzo. de 2013
'XTick' specifies the locations of the ticks. 'XTickLabel' is the labeling (i.e. the text) at the ticks.
Locks
Locks el 31 de Mzo. de 2013
perfect, thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 31 de Mzo. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by