Scatter with custom dateticks won't work

1 回表示 (過去 30 日間)
Vincent
Vincent 2012 年 6 月 12 日
Hi,
I have two vectors containing numeric data. One has numeric timestamps and shall be plotted on the x-axis. I am using dateticks to get readable tickmarks. When I tried to control the amount of ticks, I get the problem, that the ticks start (e.g.) at 2005, go up to 2011 and then restart at 2005.
My code is the following (n containing both vectors in col 1 and 2):
h = scatter(n(:,1),n(:,2),'x');
datetick('x',2);
set(gca,'XTick',min(n(:,1)):(max(n(:,1))-min(n(:,1)))/10:max(n(:,1)));
I'd provide an image but I can't find a solution to upload one in here...
  1 件のコメント
Walter Roberson
Walter Roberson 2012 年 6 月 12 日
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers

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

採用された回答

Walter Roberson
Walter Roberson 2012 年 6 月 12 日
Try setting the tick values before using datetick()
  1 件のコメント
Vincent
Vincent 2012 年 6 月 12 日
This works fine when using 'keepticks'-option in "datetick-command - thank you!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by