Formatting the plot command
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone, I currently have values on the x and y axis which are all to the power of 1 x 10^10. I would like this value to be next to each number next to the ticks. For example, on my x axis I have the numbers 1,2,3 at the ticks and at the end it has x10^10. Is there a way to format the axis so that it looks something like 1 x 10^10 2x10^10 3x10^10 ?
Thank you
0 comentarios
Respuestas (3)
per isakson
el 29 de Dic. de 2012
There is no simple way to do that. However, it can be done with the help of the property, YTickLabel, of the handle graphic object, axes. The doc says:
XTickLabel, YTickLabel, ZTickLabel
string
Tick labels. A matrix of strings to use as labels for tick marks along the
respective axis. These labels replace the numeric labels generated by MATLAB.
If you do not specify enough text labels for all the tick marks, MATLAB uses
all of the labels specified, then reuses the specified labels.
0 comentarios
José-Luis
el 30 de Dic. de 2012
xVals = 1e10:1e10:1e11;
aH = axes;
plot(aH,xVals,rand(10,1));
set(gca,'XTickLabel',sprintf('%2.0e|',xVals));
Please see
doc sprintf
for other possible label formats.
0 comentarios
Ver también
Categorías
Más información sobre Grid Lines, Tick Values, and Labels 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!