how to force matlab to display enough numbers on the plot X and Y?

0

1

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.

screenshot

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

javapowered

Posted 2012-07-21T12:42:39.340

Reputation: 773

1

Ther is an active group of Matlab programmers at StackOverflow. Have a look at the Matlab tags and consider posting there.

– ephsmith – 2012-07-21T15:09:03.487

@ephsmith thanks, next question will go to StackOverflow :) – javapowered – 2012-07-21T16:55:06.570

Answers

1

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.
plot(1:10);

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

% Create strings out of xTick numerical values with a prescribed precision.
% The format string '%a.bf' 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.

Ref: https://www.mathworks.com/support/solutions/en/data/1-3P8CU0/index.html

Anish

Posted 2012-07-21T12:42:39.340

Reputation: 26

0

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.

Dennis Jaheruddin

Posted 2012-07-21T12:42:39.340

Reputation: 378