フィルターのクリア

What is the best way to zoom this graph so there is no white space?

4 ビュー (過去 30 日間)
Grace
Grace 2024 年 5 月 6 日
コメント済み: Star Strider 2024 年 5 月 7 日
I can't seem to figure out the correct command that will change the dimension of the graph so that there is no white space on the right (see attached). Could someone please help me?

採用された回答

Star Strider
Star Strider 2024 年 5 月 6 日
pix = dir('*.png');
for k = 1:numel(pix)
figure
imshow(imread(pix(k).name))
end
Add this line after the plot:
xlim([min(intervalf) max(intervalf)])
I would add that to your code if I could, however I cannot run images of code.
.
  5 件のコメント
Star Strider
Star Strider 2024 年 5 月 6 日
I was going to suggest using the xticks function, however for whatever reason that doesn’t work as well as the old standby set function in this instance.
Try this —
functionf = @(x) exp(x) + 1;
intervalf = linspace(0, log(5), 1E+3);
figure
plot(intervalf, functionf(intervalf))
hold on
patch([intervalf flip(intervalf)], [zeros(size(intervalf)) flip(functionf(intervalf))], 'c')
hold off
xlim([min(intervalf) max(intervalf)])
title('Without ‘xticks’ and ‘set’')
figure
plot(intervalf, functionf(intervalf))
hold on
patch([intervalf flip(intervalf)], [zeros(size(intervalf)) flip(functionf(intervalf))], 'c')
hold off
xlim([min(intervalf) max(intervalf)])
xt = xticks;
xtnew = linspace(min(xt), max(xt), numel(xt)+2);
set(gca, 'XTick',xtnew, 'XTickLabel',compose('%.2f',xtnew))
title('With ‘xticks’ and ‘set’')
Make appropriate changes to get the result you want.
.
Star Strider
Star Strider 2024 年 5 月 7 日
If my Answer helped you solve your problem, please Accept it!
.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpecifying Target for Graphics Output についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by