I would like to draw a plot like below just exact like image below, How can I do that ?
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Thorsten
2016-7-15
x=[1:6];
y=[0.19 0.525 1.175 2.795 7.008 20.210];
ax_invisible=axes('color','none','Ytick',[]);
ax2=axes;
plot(x, y, 'r-')
box off
set(gca, 'xgrid', 'off', 'ygrid', 'on')
title('start/stop time (in seconds)', 'FontWeight', 'bold');
legend('Time')
set(gca,'XTick',1:6,'tickdir','out', 'XtickLabel',[])
xt = arrayfun(@(x) {sprintf('%d', 2.^(x+1) - 1)}, x);
set(ax_invisible,'Xlim',get(ax2,'Xlim'),'XTick',x+0.5,'Xticklabel',xt);
Note that the legend is inside the plot. Positing the legend outside messes things up.
更多回答(1 个)
Walter Roberson
2016-7-15
plot(x, y, 'r')
legend('Time', 'EastOutside')
title('\bf{start/stop time (in seconds)}', 'interpreter', 'tex');
set(gca, 'xgrid', 'off', 'ygrid', 'on')
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!