plot with text function

4 ビュー (過去 30 日間)
Francesco
Francesco 2024 年 2 月 27 日
コメント済み: Sam Chak 2024 年 2 月 27 日
Hello everyone. I will try to explain my matlab question. I need to use text function in one plot. I've used this function to plot all the lines:
text(ToH_v(1),SAT_disponibili(k),str,'FontSize',3.5, 'FontWeight','bold')
The problem is that I need all different lines coincide with the right edge of the grid (no empty space). I've tried to modified the FrontSize but I think it only can be multiple of 0.5. ( for example with FrontSize 3.5 and 3.7 the plot is the same). How Can I solve this problem? I've indicated the white space with the vertical arrow.
Is also possibile to remove the grid on the edge? Indicated with the horizontal arrow?
Thank you in advance.
  4 件のコメント
Aquatris
Aquatris 2024 年 2 月 27 日
Depends on the problem but one way to remove the white space at the right side of the figure is using the xlim() function to adjust the x-axis to desired range.
Francesco
Francesco 2024 年 2 月 27 日
I need that all the right edges of the lines coincide with value 24 of x axis and the left edges coincide with 0 of x axis.

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

回答 (1 件)

Sam Chak
Sam Chak 2024 年 2 月 27 日
@Francesco, do you want to display the figure without tick marks?
ax = axes(figure()); % create axes handle
plot(0:10); xlabel x, ylabel y
set(ax, 'XTick', []);
set(ax, 'YTick', []);
  2 件のコメント
Francesco
Francesco 2024 年 2 月 27 日
I want the value 2 4 6 ... in the x axes and 0 1 2 3 4..... in the y axis but without the edge grid.
Sam Chak
Sam Chak 2024 年 2 月 27 日
One side effect of disabling the tick marks is that the tick labels also disappear. Without the tick marks, the tick labels lose their significance. What do you think about this "box-off" approach?
plot(0:10, 0:10)
box off
xticklabels({'0', '2', '4', '6', '8', '10'})

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

カテゴリ

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

タグ

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by