comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » colored vector plots
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
colored vector plots [message #87861] Fri, 28 February 2014 07:08 Go to next message
anil is currently offline  anil
Messages: 34
Registered: August 2009
Member
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?
Thanks in advance,
Anil
Re: colored vector plots [message #87862 is a reply to message #87861] Fri, 28 February 2014 07:19 Go to previous messageGo to next message
David Fanning is currently offline  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.")
Re: colored vector plots [message #87874 is a reply to message #87862] Sat, 01 March 2014 11:07 Go to previous messageGo to next message
anil is currently offline  anil
Messages: 34
Registered: August 2009
Member
On Friday, February 28, 2014 5:19:56 PM UTC+2, David Fanning wrote:
> 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.")

Thanks a lot David.
Re: colored vector plots [message #87875 is a reply to message #87874] Sat, 01 March 2014 13:18 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
anil writes:

> Thanks a lot David.

I didn't work very hard. I found this in the header of the Partvelvec
program. :-)

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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Mavericks: NG plots start out black
Next Topic: How to align two images IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:42:15 PDT 2025

Total time taken to generate the page: 0.01054 seconds