how to mark the first and the last points on the plot
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I could not have the value at the end point of the plot when I used the following code as an example:
plot(1:1:100,data(1:1:100));
set(gca,'XTick',1:10:100);
set(gca,'XTickLabel',0:1:9);
but I could not have first and last point value properly. How can I set them at the first and the last position well?
If you know anyone on my question, please let me know. Thank you.
0 comentarios
Respuestas (1)
Fangjun Jiang
el 1 de Dic. de 2011
I don't fully understand your question or problem. Is this what you want?
plot(1:1:100,data(1:1:100));
set(gca,'XTick',0:10:100);
set(gca,'XTickLabel',0:1:10);
Update
plot(1:100,1:100);
set(gca,'XTick',1:10:101);
set(gca,'XTickLabel',0:1:10);
axis([0 110 0 110])
3 comentarios
Walter Roberson
el 1 de Dic. de 2011
You do not get the 10 in your original code because your original code stops labeling at 9.
When I try Fangjun's code, I do get the 10 appearing.
To get the plot box to touch the outside of the plot, command
axis tight
Fangjun Jiang
el 1 de Dic. de 2011
To have 11 Xticks starting from 1, you will have to use 1:10:101, not 1:10:100.
You data range is from 1 to 100. The axis is set automatically so xlim is set at [1 100]. To show the Xtick of 101, you will need to use xlim() or axis() to set it properly. See update.
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!