In Matlab how do I change the arrow head style in quiver plot?

前端 未结 5 1385
耶瑟儿~
耶瑟儿~ 2020-12-05 03:23

I would like to change the default arrow head style in quiver plot. How can I change it?

5条回答
  •  日久生厌
    2020-12-05 04:03

    Check out arrow3() from the MATLAB file-exchange

    https://www.mathworks.com/matlabcentral/fileexchange/14056-arrow3

    In addition to these examples.

    https://kr.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/14056/versions/16/previews/arrow3_examples.html

    It is faster than the annotation command, and produces similar results. Using the above examples

    headWidth =0.8;  % 1/10 of annotation
    headLength=0.8;  % 1/10 of annotation
    LineLength = 0.08; % same as annotation
    
    
    [x,y] = meshgrid(0:0.2:2,0:0.2:2);
    u = cos(x).*y;
    v = sin(x).*y;
    
    figure();
    %hq = quiver(x,y,u,v);
    p1 = [x(:) y(:)]; % data start point
    u = u(:); v=v(:);
    arrow3(p1,p1+LineLength*[u,v],'k',headWidth,headLength);
    

    Sorry I can't post a picture of this plotted, since I need to earn more reputation points. The arrowheads are closed and all similar size, like the annotation command would give.

提交回复
热议问题