Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The problem is that matlab "cuts" some numbers and I do not recognize actual value. Look at the screenshot, on Y there are a lot of "0.0156" while I expect "0.01562" "0.01564" "0.01566" etc.


How to say matlab to display enough numbers so I can recognize actual value?

share|improve this question
Ther is an active group of Matlab programmers at StackOverflow. Have a look at the Matlab tags and consider posting there. – ephsmith Jul 21 '12 at 15:09
@ephsmith thanks, next question will go to StackOverflow :) – javapowered Jul 21 '12 at 16:55
up vote 1 down vote accepted

The ability to specify the precision of the tick labels on an axis is not available in MATLAB 7.3 (R2006b).

To work around this issue, you can retrieve the ticks, convert them to strings with a specified precision, and set the labels to the new tick labels. The following example code can be executed at the MATLAB command prompt, to illustrate this work around:

% Create an example plot.

% Query xTick numerical values.
xTick = get(gca,'xTick');

% Create strings out of xTick numerical values with a prescribed precision.
% The format string '' means to present the values within a field that
% is wide enough to fit 'a' digits with 'b' digits after the decimal point
% in the format of a 'f'loating point number.
xTickLabel = arrayfun( @(x) sprintf('%3.2f',x), xTick, 'uniformoutput', false); 

% Use xTickLabel on the plot.
set(gca, 'xTickLabel', xTickLabel);

Note that once the tick labels have been set, they are in manual mode. The tick labels will not update automatically with the resizing of the figure window or zooming in and out of the window.


share|improve this answer

This may not be the nicest solution but it should allow you to distinguish the values:

Multiply all values by 1000, then just add a label or title that makes clear that the values are multiplied by 1000.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .