【问题标题】:Is it possible to plot a figure with arrows as shown in image attached in MATLAB?是否可以绘制带有箭头的图形,如 MATLAB 中附加的图像所示?
【发布时间】:2021-02-28 12:44:56
【问题描述】:

我可以在 Matlab 中绘制这样的图吗?如果不是,什么是正确的软件来绘制它?稍后,我需要将图形粘贴到 MS word 文件中。

【问题讨论】:

    标签: matlab-figure draw matlab-guide figure matlab-compiler


    【解决方案1】:

    当然,你需要 annotation 函数,例如

    figure('Color','w');
    plot(-pi:0.01:pi,sin(-pi:0.01:pi));
    ax=gca();
    set(ax,'YAxisLocation','left','XAxisLocation','bottom','Box','off','XTick',[],'YTick',[])
    annotation('textarrow',[0.4,0.5],[0.4,0.5],'String','P')
    annotation('arrow',[ax.Position(1),sum(ax.Position([1,3]))],ax.Position([2,2]),'LineWidth',0.5);
    annotation('arrow',ax.Position([1,1]),[ax.Position(2),sum(ax.Position([2,4]))],'LineWidth',0.5);
    annotation('textbox',[ax.Position(1)-0.05,sum(ax.Position([2,4]))-0.05,0.05,0.05],'String','Q','EdgeColor','none')
    annotation('textbox',[sum(ax.Position([1,3]))-0.05,ax.Position(2)-0.05,0.05,0.05],'String','R','EdgeColor','none')
    

    【讨论】:

    • 谢谢,但箭头我的意思是 x 轴和 y 轴绘图线,如附图所示
    • @AyeshaRahim 我将代码更改为现在也在轴上绘制箭头。
    猜你喜欢
    • 2016-12-29
    • 1970-01-01
    • 2017-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-12
    相关资源
    最近更新 更多