Number conversion and rectangle around text

1 回表示 (過去 30 日間)
Sepp
Sepp 2014 年 6 月 18 日
コメント済み: Image Analyst 2014 年 6 月 19 日
Hi
I'm currently using bar plots and I have two small questions hoping somebody can help.
1. I have the following in my code
text(x(j)-0.15, y(j)+0.07+spacing, num2str(y_old(j)), 'VerticalAlignment', 'top', 'FontSize', 16, 'fontname', 'times', 'BackgroundColor', [1 1 1])
Around this text there is a rectangle (which is white in my case). How can I remove the space between the text and the rectangle so that there is no "boundary" around the text?
2. I'm using in my bar plots two different types of numbers: e.g. 0.000523523 and 1.2345
The first one I want to print in the bar plot (e.g. on the axis) as 5.234E-04 and the second one as 1.245. So all numbers should be rounded to 3 decimal places and if neccesary a E- attached.
I want this for the axis of my bar plot as well as for conversion with num2str.
How can I do that?

採用された回答

Image Analyst
Image Analyst 2014 年 6 月 19 日
Look up tick marks in the help or in Answers to see how you can modify the numerical labels on the x-axis to be exactly what you want.
  2 件のコメント
Sepp
Sepp 2014 年 6 月 19 日
Thank you. The problem with the axis labels is solved.
What remains is the problem with the rectangle around the text. Does somebody know how I can remove the space between the text and the rectangle in the text object?
Image Analyst
Image Analyst 2014 年 6 月 19 日
Adjust the first two arguments of the text() command to get the position you want.
Please mark as "Accepted" if we're done here.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by