how can I change those things to get what I want?

1 回表示 (過去 30 日間)
flashpode
flashpode 2022 年 3 月 21 日
回答済み: Pavan Sahith 2023 年 10 月 16 日
Hi, so I got a plot that has in the Xlabel the datanum of all the month and in the Ylabel the distance in each time. My plot is the following way:
How can I write in the Xlabel just the days from 1-21 and to it more width so I can read easely the graph??(change the plot size(now is a square)).
  1 件のコメント
Image Analyst
Image Analyst 2022 年 4 月 15 日
Please attach your x and y data and tell us what the x data represents.

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

回答 (1 件)

Pavan Sahith
Pavan Sahith 2023 年 10 月 16 日
Hello,
I understand you want to customize the values on x-axis and increase the width of the generated plot.
You can use ‘xticks function which sets the x-axis tick values, ticks are the locations along the x-axis.
% sample data
x = 1:30;
y = sin(x);
plot(x, y);
% using 'xticks' and 'xlabels'
xticks(1:21)
xticklabels(1:21)
Please refer to the below sample code to change the width of the plot.
currentFigure = gcf;
newPosition = [100, 100, 2000, 600]; % [left, bottom, width, height]
set(currentFigure, 'Position', newPosition);
Please refer to the MathWorks documentation to know more about the

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by