我對MatLab很新。如果我的問題很基本,我很抱歉。我正在繪製三條線。刪除Y軸圖上的科學記數圖
的問題是,如果你看看Y型滴答,你看到的百分比數字,但在科學記數法極少數:
-2.7556e 15%
我該如何擺脫這個數字?或者我如何取代0%而不是這個數字?
這是我的代碼
clf;
plot(mkt_wgt,'b- x','DisplayName','mkt_wgt','LineWidth',2,'MarkerSize',10,'MarkerEdgeColor','b');
hold on;
plot(W_BL_Idzorek,'r- x','DisplayName','W_BL_Idzorek','LineWidth',2,'MarkerSize',10,'MarkerEdgeColor','r');
plot(W_100_TF1,'g- x','DisplayName','W_100_TF1','LineWidth',2,'MarkerSize',10,'MarkerEdgeColor','g');
hold off;
grid on;
title('Effect of Casuality');
set(gca, 'xTickLabels', {'IRN1' 'IRN2' 'IRN3' 'IRN4' 'IRN5' 'IRN6' 'IRN7' 'IRN'});
set(gca, 'XTickLabelRotation');%turn it 90 degree
ylabel('Air Pollution Casuality');
set(gca, 'yTickLabels', num2str(100.*get(gca,'yTick')','%g%%'));
legend({'Tehran','Tel.Aviv','Kabul'}, 'location', 'southoutside', 'orientation', 'horizontal');
最好的問候, 瑪麗亞姆
如果您的標籤只能達到整數百分比,您可以在'num2str'調用中使用['fix'](https://www.mathworks.com/help/matlab/ref/fix.html)來循環朝向零,或將值作爲[整數](https://www.mathworks.com/help/matlab/matlab_prog/integers.html)。 – excaza