Re: colored vector plots [message #87862 is a reply to message #87861] |
Fri, 28 February 2014 07:19   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
anil writes:
>
> Dear all,
> What is the most efficient way to do colored vector plots (representing colors corresponding to their magnitude). I currently use 'msvelovect.pro' to plot vectors on map projections, but i can not seem to color them.
> Currently i just say msvelovect,u,v,lon,lat,colors=?!?something
> I guess there is not much color option in this one, so I tried partvelvec.pro, but i could not succeed there either. I defined my lon, lat,u and v are the same size = (76,51). I tried to scale_vector and cgscalevector as:
> colors=cgscalevector((indgen(n_elements(u(0:75,0:50)))),0,25 5)
> and then partvelvec,u,v,lat,lon,veccolors=colors, but it gives errors such as:
> CGDEFAULTCOLOR: Cannot determine a color from a value of 0.131613 of data
> % CGDEFAULTCOLOR: Cannot determine a color from a value of 0.197419 of data
>
> Could anyone please suggest a solution?
POSX=RANDOMU(seed,200)
POSY=RANDOMU(seed,200)
VELX=RANDOMU(seed,200)-0.5
VELY=RANDOMU(seed,200)-0.5
magnitude = SQRT(velx^2 + vely^2)
LOADCT, 5, NCOLORS=254, BOTTOM=1 ; Load vector colors
colors = BytScl(magnitude, Top=254) + 1B
PARTVELVEC, VELX, VELY, POSX, POSY, VECCOLORS=colors
END
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|