Matlab,如何在数字上调整轴值(科学记数法 - 精度不够)

时间:2011-06-27 16:04:05

标签: matlab plot number-formatting scientific-notation

  

可能重复:
  Suppress exponential formatting in figure ticks

Matlab输出我的轴标记为5.777 x10 ^ 6,对于我的图中的每个刻度标记...是否可以让matlab输出实际的十进制数而不是科学记数,因此刻度标记实际上是不同的值而不是全部5.777?目前我还不知道这些地块在太空中的位置是因为轴上缺乏精确度。

2 个答案:

答案 0 :(得分:8)

一种可能的解决方案:

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

显然,您可以根据自己的喜好自定义格式

enter image description here


x轴刻度的另一个例子。在这种情况下,标签会相互重叠。一种可能的解决方案是使用文件交换中的XTICKLABEL_ROTATE函数。

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

enter image description here

答案 1 :(得分:1)

快速破解,尝试从所有x值中减去5.777 x10 ^ 6。

相关问题