Friday, November 28, 2014

matlab fix bad ticks, fix plot print preview,

%%% nice tick format %%%%%%%%%%%%%%%%%%
% Query xTick numerical values.
yTick = get(gca,'yTick');
% Create strings out of yTick 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.
yTickLabel = arrayfun( @(y) sprintf('%1.3f',y), yTick, 'uniformoutput', false);
% Use xTickLabel on the plot.
set(gca, 'yTickLabel', yTickLabel);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
src: http://www.mathworks.com/matlabcentral/answers/103188-how-do-i-format-tick-labels

To prevent Matlab from messing it once again at the print level:


No comments:

Post a Comment