Matlab, how to adjust axis values on figures (scientific notaiton - not enough precision) [duplicate]

匆匆过客 提交于 2019-12-31 01:00:20

问题


Possible Duplicate:
Suppress exponential formatting in figure ticks

Matlab is outputting my axis markers as 5.777 x10^6 for every tick mark in my figures... is it possible to get matlab to output the actual decimal number rather than scientific notation so the tick marks are actually different values rather than all 5.777? Currently I don't really know where in space these plots are because of a lack of precision on the axis.


回答1:


One possible solution:

plot(rand(100,1).*1e6)
set(gca, 'YTickLabel', num2str(get(gca,'YTick')','%d'))

Obviously you can customize the formatting to your liking


Another example for the x-axis ticks. In this case, the labels would overlap each other. One possible solution is to use the XTICKLABEL_ROTATE function from the File Exchange.

plot(5.77*1e6:5.77*1e6+9, rand(1,10))
set(gca, 'XTickLabel', num2str(get(gca,'XTick')','%d'))  %#'
xticklabel_rotate([],45)                  %# rotate the xtick-labels 45 degrees




回答2:


As a quick hack, try subtracting 5.777 x10^6 from all the x values.



来源:https://stackoverflow.com/questions/6495653/matlab-how-to-adjust-axis-values-on-figures-scientific-notaiton-not-enough-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!