Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

scale problem using quiver

723 views
Skip to first unread message

Hua Wang

unread,
Oct 20, 2009, 1:20:21 PM10/20/09
to
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:

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')

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!

Cheers,
Hua

Hua Wang

unread,
Oct 20, 2009, 2:48:01 PM10/20/09
to
>
> 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.

Hua

Rui Ferreira

unread,
Jul 2, 2010, 4:54:24 AM7/2/10
to
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
quiver(xR,yR,U,W,scale,'r','Autoscale','off');

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.

Rui

Kurt

unread,
Aug 3, 2010, 2:15:22 PM8/3/10
to
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?

Kurt

James

unread,
Mar 1, 2011, 11:24:04 AM3/1/11
to
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') ;
set(h1,'UData',qscale*hU,'VData',qscale*hV)
hU = get(h2,'UData') ;
hV = get(h2,'VData') ;
set(h2,'UData',qscale*hU,'VData',qscale*hV)

Tiago Leal

unread,
May 30, 2011, 6:45:04 PM5/30/11
to
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.

Thanks,

Tiago Leal

Thomas Clark

unread,
Jul 13, 2011, 12:58:28 PM7/13/11
to
James,

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.

Gaspar Cid

unread,
Sep 14, 2015, 8:51:10 PM9/14/15
to
"James " <con...@geo.siu.edu> wrote in message <ikj6j4$nn7$1...@fred.mathworks.com>...
Hello, i'm using the quiver function to plot some GPS displacement ,and i'm having the scale problem. I tried using your solution James, but i'm getting this error:
"Error using handle.handle/get
Invalid or deleted object."
It's some problem with the get function, but i don't know exactly what is it. Could you give me a hand please?
Thank you

Gaspar Cid

unread,
Sep 15, 2015, 9:36:09 AM9/15/15
to
"Gaspar Cid" wrote in message <mt7q1n$r2q$1...@newscl01ah.mathworks.com>...
I solved it, after the quiver lines i added a Hold all, then the "deleted object" appears and the scale works. The problem is that the arrows of the horizontal displacements are vertical now, thus they don't show any direction. Haha, loving quivers.

ryanscott.spor...@gmail.com

unread,
Apr 24, 2019, 7:08:39 AM4/24/19
to
Thanks for the help James - it's a shame that this still happens!
0 new messages