How can I change an arrow in a quiver plot?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 4 Mar 2016
Réponse apportée : MathWorks Support Team
le 4 Mar 2016
How can I change the color/line width of a single arrow in a quiver plot?
Réponse acceptée
MathWorks Support Team
le 4 Mar 2016
This functionality does not currently exist in "quiver" in MATLAB R2015b, but the same effect can be achieved by creating two separate quiver plots and enforcing equal scales between them.
Turning off the 'AutoScale' property of "quiver" prevents "quiver" from rescaling vectors according to the data. By manually scaling the data, the same scale can be kept between two quiver plots. Refer to the following example which creates a quiver plot of a vector field and colors one of the vectors differently.
stepX = 0.2;
stepY = 0.2;
[x,y] = meshgrid(0:stepX:2,0:stepY:2);
x = x(:);
y = y(:);
u = cos(x).*y;
v = sin(x).*y;
%manually scale u and v
scale = max( stepX/max(u), stepY/max(v) );
u = scale*u;
v = scale*v;
I = 52; %choose an arrow to change
figure
a = quiver(x(I),y(I),u(I),v(I),'AutoScale','off','Color','red','MaxHeadSize',Inf);
%remove point from the data
x(I) = [];
y(I) = [];
u(I) = [];
v(I) = [];
hold on
quiver(x,y,u,v,'AutoScale','off','Color','blue')
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Vector Fields dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!