Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
scale problem using quiver

Subject: scale problem using quiver

From: Hua Wang

Date: 20 Oct, 2009 17:20:21

Message: 1 of 7

Dear All,

I am using matlab to plot some ugly vectors. I would like to plot the velocities on the vertex of a regular mesh, and also some velocities of discrete points. So I use twice QUIVER function. The simplified codes are:


The problem is the output scales are different for the mesh and the points even I used the same value for them. It looks quite silly! Could anyone let me how to solve it? Thank you very much!


Subject: scale problem using quiver

From: Hua Wang

Date: 20 Oct, 2009 18:48:01

Message: 2 of 7

> figure
> scale=0.2;
> quiver(mesh.x,mesh.y,mesh.u,mesh.v,scale,'r')
> quiver(pt.x,pt.y,pt.u,pt.v,scale,'g')

I solved my problem by dividing a scale factor from the original velocities, and then set 'AutoScale' as 'off'. Then all the vectors have the same scale at last.


Subject: scale problem using quiver

From: Rui Ferreira

Date: 2 Jul, 2010 08:54:24

Message: 3 of 7

Dear All

I have the same problem:
I have a set of vectors; I want to plot a sub-set B in blue and another sub-set (R) in red. The obvious for me would be

quiver(xB,yB,U,W,scale,'b','Autoscale','off'); hold

xB and yB are NaN where xR and yR are finite but this is irrelevant.

The output scales are apparently different; vectors of the same length are ploted with very different lengths.

Is this a bug? how do I correct this? Hua's solution does not seem to work for me.

Thanks for any help.


Subject: scale problem using quiver

From: Kurt

Date: 3 Aug, 2010 18:15:22

Message: 4 of 7

I'm having the same problem.

I simply want to plot a scalebar for my vectors, and they are clearly coming out on different scales, which is somewhat problematic! I tried Hua's suggestion also, and it didn't seem to fix it.

What is the 'AutoScale' switch for, if it doesn't switch off the Autoscaling?


Subject: scale problem using quiver

From: James

Date: 1 Mar, 2011 16:24:04

Message: 5 of 7

This had me flummoxed for a while as well. Hua's suggestion is good but incomplete. After turning off the auto-scaling (simpler to do through S=0 rather than through properties), all the vectors will be scaled to axes units. One can then rescale all to a uniform factor by multiplying the 'Udata' & 'VData' properties by that scaling factor

qscale = 0.1 ; % scaling factor for all vectors
h1 = quiver(X1,Y1,U1,V1,0) ; % the '0' turns off auto-scaling
h2 = quiver(X2,Y2,U2,V2,0) ;
hU = get(h1,'UData') ;
hV = get(h1,'VData') ;
hU = get(h2,'UData') ;
hV = get(h2,'VData') ;

Subject: scale problem using quiver

From: Tiago Leal

Date: 30 May, 2011 22:45:04

Message: 6 of 7

Dear all,

I am using the quiver function to display the orientation within high resolution images.

The vector apear at each pixel, anyone knows how to decrease the resolution of the quiver arrows in relation to the images?? I want to see the arrows in a high resolution domain.

Essentially I want to put a vector for each group of binned pixels so that the high res image has a vector corresponding to a group of say 2x2 pixels. This will make the arrows less dense and easier to view.


Tiago Leal

Subject: scale problem using quiver

From: Thomas Clark

Date: 13 Jul, 2011 16:58:28

Message: 7 of 7


Thanks, that's a nice solution which will also work with Quiver3.

Shame that it isn't built into the functionality though, for large quivergroups this can take quite a while to update. I'd have thought that TMW would have foreseen this need when writing the function.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us