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

Home » Public Forums » archive » help with cgDrawVectors
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
help with cgDrawVectors [message #91191] Mon, 15 June 2015 08:31 Go to next message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
Hi

I have an image 216x216. I wanted to overplot on that image the vectors.

Below it's my code

vector_size = fltarr(20,20)
dims_i_need = size(vector_size, /Dimensions)
posx = Rebin(Findgen(dims_i_need[0]), dims_i_need[0], dims_i_need[1])
posy = Rebin(Reform(Findgen(dims_i_need[1]), 1, dims_i_need[1]), dims_i_need[0], dims_i_need[1])

cgDisplay, 100,100
cgimage, image
cgDrawVectors, Vx, Vy, posx, posy, /ORDERED, overplot = 1

The problem is that the vectors are not plotted at the whole image but at a part of the image.
posx and posy are positions arrays. If the image is [216,216] and the vectors have dimensions [20,20] how we can plot this on top of the whole image?
Re: help with cgDrawVectors [message #91194 is a reply to message #91191] Mon, 15 June 2015 17:26 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
g.nacarts@gmail.com writes:

> I have an image 216x216. I wanted to overplot on that image the vectors.
>
> Below it's my code
>
> vector_size = fltarr(20,20)
> dims_i_need = size(vector_size, /Dimensions)
> posx = Rebin(Findgen(dims_i_need[0]), dims_i_need[0], dims_i_need[1])
> posy = Rebin(Reform(Findgen(dims_i_need[1]), 1, dims_i_need[1]), dims_i_need[0], dims_i_need[1])
>
> cgDisplay, 100,100
> cgimage, image
> cgDrawVectors, Vx, Vy, posx, posy, /ORDERED, overplot = 1
>
> The problem is that the vectors are not plotted at the whole image but at a part of the image.
> posx and posy are positions arrays. If the image is [216,216] and the vectors have dimensions [20,20] how we can plot this on top of the whole image?

You need to set up the appropriate coordinate system (probably through a
set of axes) for your image, in order for your vectors to be draw on top
of it in that coordinate system.

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: help with cgDrawVectors [message #91200 is a reply to message #91194] Tue, 16 June 2015 08:11 Go to previous messageGo to next message
g.nacarts is currently offline  g.nacarts
Messages: 148
Registered: November 2013
Senior Member
I used the XRANGE and YRANGE keywords basically.

i.e. cgimage, image, xrange=[0,19], yrange=[0,19]

The vectors have size [20,20]. When I used xrange=[0,20] and yrange=[0,20] a very small part on the top and left side of the image was empty, so I reduce the max value to 19 but I am not sure whether this make sense or not.
Re: help with cgDrawVectors [message #91202 is a reply to message #91200] Tue, 16 June 2015 18:57 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
g.nacarts@gmail.com writes:

> The vectors have size [20,20]. When I used xrange=[0,20] and yrange=[0,20] a very small part on the top and left side of the image was empty, so I reduce the max value to 19 but I am not sure whether this make sense or not.

What would you need to know to make you sure?

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: I am missing plot.pro
Next Topic: % error opening file

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

Current Time: Wed Oct 08 09:23:05 PDT 2025

Total time taken to generate the page: 0.00443 seconds