Unequal tick distribution on axis

6 ビュー (過去 30 日間)
Adrian
Adrian 2011 年 11 月 14 日
Is there a way i can manually set the tick marks of the x axis in a way that they aren't equally distributed?
For the x axis, I need to plot at 101217, 101223, 101229, 110107, 110112, 110121, and 110130. The numbers correspond to yy-mm-dd. This leads to an unclear graph with a jumble of data points in the 100,000 range and a jumble in the 110,000 range.
So, how do i get tick marks at just the above points?

回答 (3 件)

Titus Edelhofer
Titus Edelhofer 2011 年 11 月 14 日
Hi Adrian,
just set the ticks:
set(gca, 'Xtick', [101217 101223 101229])
Or did I misunderstand something?
Titus

Adrian
Adrian 2011 年 11 月 14 日
I have tried that but the problem is that the automatic scaling makes it hard to distinguish between the different dates.
Here is a picture of the graph I created:
  1 件のコメント
Adrian
Adrian 2011 年 11 月 14 日
I just can't figure out how to make it so the ticks don't have equal spacing between them

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


Kelly Kearney
Kelly Kearney 2011 年 11 月 14 日
Do you really want to plot all your data with such an odd x coordinate system? I would recommend translating your x coordinates to datenumbers, then use datetick to label the axis.
t = [101217, 101223, 101229, 110107, 110112, 110121, 110130];
y = rand(7,1); % some fake data
dn = datenum(num2str(t'), 'yymmdd');
plot(dn, y, 'b.');
datetick('x',25);

カテゴリ

Help Center および File ExchangeGrid Lines, Tick Values, and Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by