Scale axis (pixel : represented unit)
显示 更早的评论
Hello everybody!
Could anyone help me with axis scaling? I have several data series each for a different time frame, and would like to plot each in a separate figure. For better comparison, it would be nice if they all had the same time scaling (e.g. 100 pixels represent one month).
What I have tried so far looks roughly like that:
% First plot:
figure(1)
plot(time1,data1)
% set axis limits:
x1 = [time1(1) time1(end)];
xlim(x1)
datetick('keeplimits')
% set size of graph:
% pos_h is position_horizontal
% pos_v is position_vertical
set(gcf,'position',[pos_h,pos_v,width*x1/x1,hight])
% Second plot:
figure(2)
plot(time2,data2)
% set axis limits:
x2 = [time2(1) time2(end)];
xlim(x2)
datetick('keeplimits')
% set size of graph:
% pos_h is position_horizontal
% pos_v is position_vertical
set(gcf,'position',[pos_h, pos_v, width*x2/x1, hight])
However, this does not work properly. I guess it is because of the title, axis labels, ticks etc. which are also space consuming and not included in a simple calculation like "x2/x1". The same problem occurs with
fig = figure()
set(fig,'Position',[...]);
I'd appreciate all help and also useful links (as there surely must be solution somewhere - just that I could not find it)!
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 2-D and 3-D Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!