Problem with X/Ylim and X/YTick in Matlab figures

3 ビュー (過去 30 日間)
Mahtab Farahbakhsh
Mahtab Farahbakhsh 2017 年 7 月 10 日
コメント済み: Mahtab Farahbakhsh 2017 年 7 月 10 日
Hi,
I'm trying to plot a figure in Matlab, but when I define XLim and XTick (in different ways, e.g., ax.XLim, gca, XLim([0 30]), etc.,...), my plot end up with different axes limit and tick. This is the piece of code that I'm using now:
figure()
plot(f, S_end, 'b:');
% annotate and format
legend('Empirical','Location','South');
ax = gca;
ax.YScale = 'log';
ax.XScale = 'log';
xlabel('Spatial Frequency (cpd)'); ylabel('Contrast Sensitivity (1/C)')
ax.XLim = [0 30];
ax.YLim = [0 80];
ax.XTick = [1 2 5 10 20 30];
ax.YTick = [0 10 20 30 50 60 70];
The output that I get is attached.
Could you please help me how to solve this problem?
  2 件のコメント
Adam
Adam 2017 年 7 月 10 日
You haven't told us either what the problem is or what the expected output is.
Mahtab Farahbakhsh
Mahtab Farahbakhsh 2017 年 7 月 10 日
I have attached the output as a .png file. Can you find that? I've mentioned that the problem is my plot ends up with different xtick and xlim than the ones I defined for it (e.g., I define XLim([0 30]) , but the plot ends up with XLim([2 30])).
Hope that makes my problem clear!

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

採用された回答

Walter Roberson
Walter Roberson 2017 年 7 月 10 日
You cannot use 0 as a limit on a log scale plot, as 0 would be infinitely far along the axis.
  1 件のコメント
Mahtab Farahbakhsh
Mahtab Farahbakhsh 2017 年 7 月 10 日
WOW! Basic math that I forgot to think about! Thank you so much!!!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by