How to adjust arrowheads in streamslice?

27 views (last 30 days)
I would like to use streamslice but the arrowheads are way too big so you can't see them anymore (see first picture). At first I was not sure if really the arrowheads were the problem but when I remove them the plot looks normal (see second picture). As I want arrowheads in the plot - does anyone know how I can solve the problem or adjust the size of the arrowheads?
Thanks in advance!
Here is my code:
syms a r
r1 = 5*10^(-11);
r2 = 0.01;
r3 = 20;
r4 = 0.1;
r5 = 1.386;
r8 = 0.0723;
r10 = 0.5;
r11 = 0.0001;
n_alpha = 1*10^(3);
r6 = 0.045;
lo_a = 0;
up_a = 10000;
lo_r = 0;
up_r = 0.8;
[A,R] = meshgrid(lo_a:100:up_a,lo_r:0.08:up_r);
a_dot = -r6.*A + r4*n_alpha*r10*r11./(r10*r11+r1*r2*A.^2.*R.^2) + r3*n_alpha*r1*r2*A.^2.*R.^2./(r10*r11+r1*r2*A.^2.*R.^2);
r_dot = -r5.*R + r4*r10*r11./(r10*r11+r1*r2*A.^2.*R.^2) + r3*r1*r2*A.^2.*R.^2./(r10*r11+r1*r2*A.^2.*R.^2);
streamslice(A,R,a_dot,r_dot,2);
xlabel('a')
ylabel('r')
xlim([lo_a up_a])
ylim([lo_r up_r])

Accepted Answer

Hannah Diethard
Hannah Diethard on 8 Feb 2023
For anyone interested: I solved to problem by rescaling r
syms a r
r1 = 5*10^(-11);
r2 = 0.01;
r3 = 20;
r4 = 0.1;
r5 = 1.386;
r8 = 0.0723;
r10 = 0.5;
r11 = 0.0001;
n_alpha = 1*10^(3);
r6 = 0.045;
lo_a = 0;
up_a = 10000;
lo_r = 0;
up_r = 1;
scale = 10000;
[A,R] = meshgrid(lo_a:100:up_a,lo_r:0.1:up_r);
a_dot = -r6.*A + r4*n_alpha*r10*r11./(r10*r11+r1*r2*A.^2.*R.^2) + r3*n_alpha*r1*r2*A.^2.*R.^2./(r10*r11+r1*r2*A.^2.*R.^2);
r_dot = -r5.*R + r4*r10*r11./(r10*r11+r1*r2*A.^2.*R.^2) + r3*r1*r2*A.^2.*R.^2./(r10*r11+r1*r2*A.^2.*R.^2);
streamslice(A,R*scale,a_dot,r_dot*scale,2);
xlabel('a')
ylabel('r')
yticks([0*scale 0.5*scale 1*scale])
yticklabels(num2str(yticks'/scale))
xlim([lo_a up_a])
ylim([lo_r*scale up_r*scale])

More Answers (1)

Gowthami
Gowthami on 27 Jan 2023
Hi,
There is no direct way to modify the arrowhead separately from the lines themselves in "streamslice".
As a workaround, you can parse through the individual lines that make up the arrowheads in the stream slice plot by checking for lines that only have 3 vertices and then modify the line properties of those line groups so that the arrowhead properties are modified. For example in the following code, I am modifying the line width of arrowheads to 0.05.
load fileName;
s = streamslice(x,y,z,u,v,w,[],[],5);
for i = 1:length(s)
% If line is part of arrowhead
if length(s(i).MarkerIndices) == 3
s(i).LineWidth = 0.05;
end
end
You can modify other arrowhead properties too by looking at a list of all available properties:
  1 Comment
Hannah Diethard
Hannah Diethard on 27 Jan 2023
Hi,
thanks for your answer! Unfortunately, this changes only how thick or thin the arrowheads are but not how long which is the problem I think ...

Sign in to comment.

Categories

Find more on Data Distribution Plots in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!