How Do I Remove Scientific Notation From X/Y Axes on Plotted Data

83 ビュー (過去 30 日間)
Thomas Gunther
Thomas Gunther 2018 年 5 月 1 日
コメント済み: Nachiket 2024 年 2 月 1 日
I have large data files collected over a long time period where time sampling is in seconds. So measured data magnitude plotted against time may produce the Time scale going from 0 to tens of thousands of seconds. The X-Axis is set for Sampling Time and always is displayed in scientific notation. How do I prevent this scaling from showing scientific notation and still maintain proper scaling when zooming in on data? When I set XTick Label from num2str on the Time Array plotted, the time does not scale accurately when zooming in on specific regions of data.

採用された回答

Walter Roberson
Walter Roberson 2018 年 5 月 1 日
From R2015b onwards,
ax = gca;
ax.XRuler.Exponent = 0;
  6 件のコメント
Bryan
Bryan 2020 年 2 月 20 日
Hey, thanks for your reply. I will look into that.
Nachiket
Nachiket 2024 年 2 月 1 日
Thank you this worked!!!

サインインしてコメントする。

その他の回答 (1 件)

dpb
dpb 2018 年 5 月 1 日
編集済み: Walter Roberson 2018 年 5 月 1 日
Yes, when you set the tick label that then becomes hardwired text independent of the value.
Are the x axis variable(s) in datetime or just double in seconds? If numbers get too many orders of magnitude you may well run out of room to write all the necessary digits.
You can play around with the axis numeric or datetime ruler depending on the data source but owing to the aforementioned length of the data string you might consider scaling the values and using annotation either in the ticklabel format itself or just as part of the axis title--consider
hAx=subplot(2,1,1);
plot(linspace(0,35000,10)/1000,randn(1,10))
hAx.XAxis.TickLabelFormat='%.f k';
hAx(2)=subplot(2,1,2);
plot(linspace(0,35000,10)/1000,randn(1,10))
xlabel('Time, ksec')
results in
Unlimited variations on a them, of course...

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by