Using datetime in surf plot
5 ビュー (過去 30 日間)
古いコメントを表示
I have a bunch of subplots that are linked with linkaxes and I currently use the FEX function dynamicDateTicks to update the tick labels when I zoom. BUT. The new datetime format looks better (less crowded) on the graphs. Only I can't get it (datetime) to work with a surf plot.
Here's a minimal working example:
X = 25:25:100;
T = datenum(2015,01,01,1:4,0,0);
Z = [ 1 2 3 4;
5 6 7 8;
9 10 11 12;
13 14 15 16];
[Xmesh,Tmesh] = meshgrid(X,T);
% Tmesh = datetime(Tmesh,'ConvertFrom','datenum');
figure;
surf(Tmesh,Xmesh,Z);
If you uncomment the one line, this gives me the error:
Error using surf (line 57)
X, Y, Z, and C cannot be complex.
Anyone else have this problem? It seems like a bug, since it works fine with any other plot. For example:
plot(datetime(2014,01,1:2),1:2)
Any help would be appreciated. And just to be clear, I currently can get it all to work with dynamicDateTicks (datetick), I'm just hoping for a cleaner plot.
0 件のコメント
採用された回答
Star Strider
2015 年 1 月 30 日
I can’t find it in the documentation just now, but datetime doesn’t work with ‘surface’ plots. It works with 2D plots only.
I believe datetick will still work on ‘surface’ plots.
2 件のコメント
Star Strider
2015 年 2 月 2 日
My pleasure.
Unfortunate indeed. Maybe in the next version or two it will work with surface plots.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!