Code covered by the BSD License  

Highlights from
Quiverc

4.3

4.3 | 10 ratings Rate this file 41 Downloads (last 30 days) File Size: 3.08 KB File ID: #3225
image thumbnail

Quiverc

by Bertrand Dano

 

01 Apr 2003 (Updated 26 Nov 2008)

Creates a color quiver plot with arrows colors according to the magnitude of the vector.

| Watch this File

File Information
Description

This is a modified version of the function quiver [from C.M. Thompson] to plot velocity vectors as arrows with components (u,v) at the points (x,y) with the color corresponding to the magnitude of the vector and using the current colormap.

Tip: for best results, add set(gcf, 'InvertHardCopy', 'off') after the function to keep the black background on the hardcopy. See attached examples.

Acknowledgements
This submission has inspired the following:
quiverc2, quiverc2wcmap
MATLAB release MATLAB 5.3 (R11)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (14)
06 May 2004 Klaas Hartmann

I find the output of quiverc easier to interpret than that of quiver. My only qualm is that it runs a bit slow with the data I am plotting -- I wan't to show a sequence of quiver plots. Also it doesn't seem to handle NaNs in the data automatically (just replace them with 0s)

01 Sep 2004 Peter Slovinsky

I was working with quiver plots to show current velocity and direction from a moving vessel. The quiverc is perfect for creating a figure that is easy to qualitativy interpret.

08 Dec 2004 Kwijibo Lefever

Not as fast as quiver for large vector/velocity field. But fine otherwise.

21 Jul 2005 Colin Ned

great job, save me much time to write code

31 Jan 2006 Gavita Regunath

Brilliant and extremely useful! Thanks!

27 Apr 2006 tuna kaskati  
16 Jul 2006 Ching-Fang Lee

It's a very useful tool for ploting! Thanks!

06 Feb 2007 David Kolin

Excellent, except that the color mapping is incorrect if the current colormap is longer than 64. Changing the two int8 calls in quiverc to int16 fixes this problem.

30 Aug 2007 Alison Rogers

Thanks! This is very useful.

12 Mar 2008 Burak eral

Hi Bertrand;

I am using your cool code quiverc for plotting velocity fields that evolve over time… In your code you normalize colormaps so that red in colorbar refers to max velocity with in frame… I am trying have a global colormap where I insert max value velocity value within my frames so red refers to this value at all times…

I tried to change max(vr(:)) in code below with my global max value but it does not work…

vr=sqrt(u.^2+v.^2);
vrn=round(vr/max(vr(:))*64);
CC=colormap;
ax = newplot;
next = lower(get(ax,'NextPlot'));
hold_state = ishold;

Do you have an idea how I can go around this ?

Thanks in advance
Burak

21 Mar 2009 Vinesh Rajpaul

Great file, thanks! But -- is there any way to use quiverc.m to create a colour quiver plot, but with all arrows plotted with same lengths? I.e. magnitude of vectors to be indicated solely by color and not length. It's redundant to indicate magnitude both by length and color; moreover, some vectors are often so small (relative to others in the field) that they are "invisible", in which case the colormap is useless anyway. Thanks.

22 Apr 2009 JH

good job, but one comment: when I use h=quiverc(x,y,U,V,S), it seems the code can not return h? In other words, quiverc(x,y,U,V,S) works, but h=quiverc(x,y,U,V,S) does not work.

23 Mar 2011 Tiago Leal

??? Attempted to access CC(5,1); index out of bounds because size(CC)=[2,3].

Error in ==> quiverc at 134
    c1= CC(ii,1); c2= CC(ii,2); c3= CC(ii,3);

I have this error when I run the codes. C(x,1) x is alwyas different and bigger than 2. Anyone can help me??

23 Mar 2011 Tiago Leal

I already found the problem. My code had colormap(gray(2)) before the plot.

Please login to add a comment or rating.
Updates
08 Apr 2003

Mislabeled the submission name

12 Aug 2008

syntax error in description

26 Nov 2008

Wrong title on the page

Tag Activity for this File
Tag Applied By Date/Time
coding theory Bertrand Dano 22 Oct 2008 06:59:26
information theory Bertrand Dano 22 Oct 2008 06:59:26
quiver Bertrand Dano 22 Oct 2008 06:59:26
color Bertrand Dano 22 Oct 2008 06:59:26
function quiver Bertrand Dano 22 Oct 2008 06:59:26
vectors Bertrand Dano 22 Oct 2008 06:59:26
velocity Bertrand Dano 22 Oct 2008 06:59:26
cm thompson Bertrand Dano 22 Oct 2008 06:59:26
vectors Cristina McIntire 05 Dec 2008 14:40:23
cm thompson Andrew Jackson 19 Mar 2009 13:57:04
cm thompson Toyin 31 Jul 2009 05:54:50

Contact us at files@mathworks.com